authorgravatar for shawn@git.icuShawn Landden <shawn@git.icu> 2019-03-22 14:35:24-06:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-26 12:00:55-04:00
log51be449a57010a27382cb8104740b34f7863876b
treef5f04ba93270a3f330cd3ff3c0a6a0f41759ecf5
parent1d09cdaa6a79e0f0baa24d95c7fa992829cd455f

std.ascii: respond to review

This won't generate as much mode in debug mode, as it doesn't check for overflow.

1 files changed, 3 insertions(+), 7 deletions(-)

std/ascii.zig+3-7
......@@ -154,12 +154,8 @@ pub fn isAlpha(c: u8) bool {
154154 return inTable(c, tIndex.Alpha);
155155}
156156
157pub fn isCtrl(c: u8) bool {
158 return c < 0x20 or c == 127; //DEL
159}
160
161157pub fn isCntrl(c: u8) bool {
162 return isCtrl(c);
158 return c < 0x20 or c == 127; //DEL
163159}
164160
165161pub fn isDigit(c: u8) bool {
......@@ -204,7 +200,7 @@ pub fn isBlank(c: u8) bool {
204200
205201pub fn toUpper(c: u8) u8 {
206202 if (isLower(c)) {
207 return c - 0x20;
203 return c | ~0b00100000;
208204 } else {
209205 return c;
210206 }
......@@ -212,7 +208,7 @@ pub fn toUpper(c: u8) u8 {
212208
213209pub fn toLower(c: u8) u8 {
214210 if (isUpper(c)) {
215 return c + 0x20;
211 return c & 0b00100000;
216212 } else {
217213 return c;
218214 }