diff options
-rw-r--r-- | lib/pure/strutils.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index f0b447de7..8cbc947bf 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -209,7 +209,7 @@ proc toLowerAscii*(c: char): char {.noSideEffect, doAssert toLowerAscii('A') == 'a' doAssert toLowerAscii('e') == 'e' if c in {'A'..'Z'}: - result = chr(ord(c) + (ord('a') - ord('A'))) + result = char(uint8(c) xor 0b0010_0000'u8) else: result = c @@ -248,7 +248,7 @@ proc toUpperAscii*(c: char): char {.noSideEffect, doAssert toUpperAscii('a') == 'A' doAssert toUpperAscii('E') == 'E' if c in {'a'..'z'}: - result = chr(ord(c) - (ord('a') - ord('A'))) + result = char(uint8(c) xor 0b0010_0000'u8) else: result = c |