From: Volker Lendecke Date: Mon, 19 Feb 2024 12:15:55 +0000 (+0100) Subject: lib: Simplify _hexcharval X-Git-Tag: tdb-1.4.11~1491 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=97896fa7e54039b0a56510f9ccd22e71fb42b42c;p=thirdparty%2Fsamba.git lib: Simplify _hexcharval Saves a few bytes and conditional jumps Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett --- diff --git a/lib/replace/replace.h b/lib/replace/replace.h index a6a2b40777f..537e61e1e48 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -1079,7 +1079,7 @@ static inline bool uid_wrapper_enabled(void) static inline bool _hexcharval(char c, uint8_t *val) { if ((c >= '0') && (c <= '9')) { *val = c - '0'; return true; } - if ((c >= 'a') && (c <= 'f')) { *val = c - 'a' + 10; return true; } + c &= 0xDF; /* map lower to upper case -- thanks libnfs :-) */ if ((c >= 'A') && (c <= 'F')) { *val = c - 'A' + 10; return true; } return false; }