diff options
Diffstat (limited to 'libc/bionic/ctype.cpp')
-rw-r--r-- | libc/bionic/ctype.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/bionic/ctype.cpp b/libc/bionic/ctype.cpp index 2b31d5268..b72935ba4 100644 --- a/libc/bionic/ctype.cpp +++ b/libc/bionic/ctype.cpp @@ -83,3 +83,15 @@ int toupper_l(int c, locale_t) { int tolower_l(int c, locale_t) { return tolower(c); } + +int tolower(int c) { + if (c >= 'A' && c <= 'Z') return c | 0x20; + return c; +} + +int toupper(int c) { + // Using EOR rather than AND makes no difference on arm, but saves an + // instruction on arm64. + if (c >= 'a' && c <= 'z') return c ^ 0x20; + return c; +} |