diff options
author | Julius Werner <jwerner@chromium.org> | 2024-08-15 13:43:12 -0700 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-08-19 13:25:05 +0000 |
commit | f9ab107d32f9a92841430866096a63746bb96fe2 (patch) | |
tree | 5879fbee8a699ff4caaea06faba05cacb666c4f7 /util | |
parent | 82c0dd29099fc89826e332d2720f7e7e60f77f0e (diff) |
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>
Diffstat (limited to 'util')
0 files changed, 0 insertions, 0 deletions