coreboot-kgpe-d16/tests
Yu-Ping Wu 00c834dc26 lib: Fix log2_ceil() for 0xffffffff
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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59834
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
2021-12-08 00:51:43 +00:00
..
acpi
commonlib
console
data/lib/lzma-test tests: Add lib/lzma-test test case 2021-10-14 13:13:07 +00:00
device
include tests: Add lib/cbfs-lookup-test test case 2021-09-14 23:35:38 +00:00
lib lib: Fix log2_ceil() for 0xffffffff 2021-12-08 00:51:43 +00:00
mock tests: Add lib/cbfs-lookup-test test case 2021-09-14 23:35:38 +00:00
stubs tests/stubs/console: Allow enabling printk to print to stdout 2021-09-13 14:00:57 +00:00
Makefile.inc tests: Disable -Wmain-return-type for clang 2021-12-07 17:47:35 +00:00