cbfstool: Change FMAP granularity to 16 bytes

Instead of looking for an FMAP at every byte,  only search down
to a granularity of 16 bytes, reducing the time for a cbfstool
call by 0.3s when no FMAP is found.

Signed-off-by: Stefan Reinauner <reinauer@chromium.org>
BUG=none
BRANCH=none
TEST=time ./cbfstool coreboot.rom add -f locale_de.bin -n locale_de.bin -t 0x50 -c lzma
     is 0.3s faster than before.

Change-Id: Icb4937330e920ae09928ceda7c1af6a3c5130ac7
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: bc92d838ba9db7733870ea6e8423fa4fa41bf8fe
Original-Change-Id: Idbaec58a199df93bdc10e883c56675b419ab5b8e
Original-Reviewed-on: https://chromium-review.googlesource.com/317321
Original-Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Original-Tested-by: Stefan Reinauer <reinauer@chromium.org>
Original-Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://review.coreboot.org/12932
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Stefan Reinauer 2015-12-09 15:11:42 -08:00 committed by Patrick Georgi
parent d201e8c38a
commit 924f0a6421
1 changed files with 1 additions and 1 deletions

View File

@ -139,7 +139,7 @@ static long int fmap_bsearch(const uint8_t *image, size_t len)
* remainder when modding the offset with the previous stride. This
* makes it so that each offset is only checked once.
*/
for (stride = len / 2; stride >= 1; stride /= 2) {
for (stride = len / 2; stride >= 16; stride /= 2) {
if (fmap_found)
break;