coreboot/src/commonlib/bsd
Julius Werner f9ab107d32 commonlib/bsd: Optimize strnlen()
This patch changes the strnlen() implementation to fix a small issue
where we would dereference once more byte than intended when not finding
a NUL-byte within the specified amount of characters. It also changes
the implementation to rely on a pre-calculated end pointer rather than a
running counter, since this seems to lead to slightly better assembly
(one less instruction in the inner loop) on most architectures.

Change-Id: Ic36768fd3a26e2b64143904e78cd0b52ba66898d
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83933
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
2024-08-19 13:25:05 +00:00
..
include/commonlib/bsd commonlib/bsd: Add strcat() and strncat() functions 2024-08-14 03:09:20 +00:00
cbfs_mcache.c commonlib/bsd, libpayload: Do not include helpers.h in stddef.h 2023-02-16 17:55:37 +00:00
cbfs_private.c commonlib/bsd, libpayload: Do not include helpers.h in stddef.h 2023-02-16 17:55:37 +00:00
elog.c elog: calculate year correctly in timestamp 2021-09-23 06:26:19 +00:00
gcd.c commonlib: Change GCD function to always use 64 bits 2024-02-08 13:13:58 +00:00
ipchksum.c commonlib: Add assembly optimization for ipchksum() on x86 2024-02-02 22:49:10 +00:00
lz4.c.inc
lz4_wrapper.c commonlib/bsd/lz4_wrapper.c: Fix misaligned access 2024-07-01 13:44:19 +00:00
string.c commonlib/bsd: Optimize strnlen() 2024-08-19 13:25:05 +00:00