coreboot-kgpe-d16/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
..
Makefile.inc lib: Fix log2_ceil() for 0xffffffff 2021-12-08 00:51:43 +00:00
b64_decode-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
bootmem-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
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 tests: Improve test output readability 2021-09-01 19:38:09 +00:00
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 tests: Improve test output readability 2021-09-01 19:38:09 +00:00
coreboot_table-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
crc_byte-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
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 tests: Improve test output readability 2021-09-01 19:38:09 +00:00
fmap-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
hexstrtobin-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
imd-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
imd_cbmem-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
lib-test.c lib: Fix log2_ceil() for 0xffffffff 2021-12-08 00:51:43 +00:00
libgcc-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
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
malloc-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
memchr-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
memcmp-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
memcpy-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
memmove-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
memrange-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
memset-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
region_file-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
rtc-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
spd_cache-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
stack-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
string-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
timestamp-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
uuid-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00