diff --git a/pandas/_libs/src/headers/portable.h b/pandas/_libs/src/headers/portable.h index 9ac4ebc306baa..1976addace3f3 100644 --- a/pandas/_libs/src/headers/portable.h +++ b/pandas/_libs/src/headers/portable.h @@ -7,8 +7,9 @@ // GH-23516 - works around locale perf issues // from MUSL libc, MIT Licensed - see LICENSES -#define isdigit_ascii(c) ((unsigned)c - '0' < 10) -#define isspace_ascii(c) (c == ' ' || (unsigned)c-'\t' < 5) -#define toupper_ascii(c) (((unsigned)c-'a' < 26) ? (c & 0x5f) : c) +#define isdigit_ascii(c) (((unsigned)(c) - '0') < 10u) +#define isspace_ascii(c) (((c) == ' ') || (((unsigned)(c) - '\t') < 5)) +#define toupper_ascii(c) ((((unsigned)(c) - 'a') < 26) ? ((c) & 0x5f) : (c)) +#define tolower_ascii(c) ((((unsigned)(c) - 'A') < 26) ? ((c) | 0x20) : (c)) #endif