coreboot/tests/lib
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
..
b64_decode-test.c
bootmem-test.c
cbfs-lookup-test.c cbfs: Remove deprecated APIs 2021-12-06 12:36:45 +00:00
cbfs-verification-test.c cbfs: Remove deprecated APIs 2021-12-06 12:36:45 +00:00
cbmem_console-test.c
cbmem_stage_cache-test.c commonlib: Move commonlib/cbmem_id.h to commonlib/bsd/ 2021-11-30 17:23:37 +00:00
compute_ip_checksum-test.c
coreboot_table-test.c
crc_byte-test.c
dimm_info_util-test.c arch/x86: Refactor the SMBIOS type 17 write function 2021-11-11 09:10:10 +00:00
edid-test.c
fmap-test.c
hexstrtobin-test.c
imd-test.c
imd_cbmem-test.c
lib-test.c lib: Fix log2_ceil() for 0xffffffff 2021-12-08 00:51:43 +00:00
libgcc-test.c
list-test.c lib/list: Add list_append 2021-11-03 08:29:16 +00:00
lzma-test.c tests: Add lib/lzma-test test case 2021-10-14 13:13:07 +00:00
Makefile.inc lib: Fix log2_ceil() for 0xffffffff 2021-12-08 00:51:43 +00:00
malloc-test.c
memchr-test.c
memcmp-test.c
memcpy-test.c
memmove-test.c
memrange-test.c
memset-test.c
region_file-test.c
rtc-test.c
spd_cache-test.c
stack-test.c
string-test.c
timestamp-test.c
uuid-test.c