Attention is currently required from: Yu-Ping Wu. Hello build bot (Jenkins), Jakub Czapiga, Julius Werner,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/59834
to look at the new patch set (#2).
Change subject: lib: Fix edge case of log2_ceil() ......................................................................
lib: Fix edge case of log2_ceil()
Current log2_ceil(x) is defined as log2(x * 2 - 1). When x is larger than (1 << 31), (x * 2 - 1) won't fit in u32, leading to incorrect result. Therefore, correct it as (log2(x - 1) + 1). Also add unit tests for inline functions in lib.h.
BUG=none TEST=make tests/lib/lib-test BRANCH=none
Change-Id: If868f793b909a6ad7fc48a7affac15e2c714fa2e Signed-off-by: Yu-Ping Wu yupingso@chromium.org --- M src/include/lib.h M tests/lib/Makefile.inc A tests/lib/lib-test.c 3 files changed, 65 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/59834/2