aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorShawn Landden <shawn@git.icu>2019-03-22 14:35:24 -0600
committerAndrew Kelley <andrew@ziglang.org>2019-03-26 12:00:55 -0400
commit51be449a57010a27382cb8104740b34f7863876b (patch)
treef5f04ba93270a3f330cd3ff3c0a6a0f41759ecf5 /std
parent1d09cdaa6a79e0f0baa24d95c7fa992829cd455f (diff)
downloadzig-51be449a57010a27382cb8104740b34f7863876b.tar.gz
zig-51be449a57010a27382cb8104740b34f7863876b.zip
std.ascii: respond to review
This won't generate as much mode in debug mode, as it doesn't check for overflow.
Diffstat (limited to 'std')
-rw-r--r--std/ascii.zig10
1 files changed, 3 insertions, 7 deletions
diff --git a/std/ascii.zig b/std/ascii.zig
index 5a35fa2466..4b2a40d9ea 100644
--- a/std/ascii.zig
+++ b/std/ascii.zig
@@ -154,12 +154,8 @@ pub fn isAlpha(c: u8) bool {
return inTable(c, tIndex.Alpha);
}
-pub fn isCtrl(c: u8) bool {
- return c < 0x20 or c == 127; //DEL
-}
-
pub fn isCntrl(c: u8) bool {
- return isCtrl(c);
+ return c < 0x20 or c == 127; //DEL
}
pub fn isDigit(c: u8) bool {
@@ -204,7 +200,7 @@ pub fn isBlank(c: u8) bool {
pub fn toUpper(c: u8) u8 {
if (isLower(c)) {
- return c - 0x20;
+ return c | ~0b00100000;
} else {
return c;
}
@@ -212,7 +208,7 @@ pub fn toUpper(c: u8) u8 {
pub fn toLower(c: u8) u8 {
if (isUpper(c)) {
- return c + 0x20;
+ return c & 0b00100000;
} else {
return c;
}