authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-09-21 21:36:17+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-11-05 16:10:34+01:00
log3a1f515e09902eeaafce0d1cd03c8472af6eacd0
tree1b577eb5f63fb37c2c7929db9b26c7da1a31e6f4
parent1982e0c18a5d46a86ca411661a4d25039eb269e7

Address review comments


1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/fmt.zig+2-2
...@@ -561,7 +561,7 @@ pub fn formatIntValue(...@@ -561,7 +561,7 @@ pub fn formatIntValue(
561 if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) {561 if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) {
562 return formatUnicodeCodepoint(@as(u21, int_value), options, writer);562 return formatUnicodeCodepoint(@as(u21, int_value), options, writer);
563 } else {563 } else {
564 @compileError("Cannot print integer that is larger than 32 bits as an UTF-8 sequence");564 @compileError("Cannot print integer that is larger than 21 bits as an UTF-8 sequence");
565 }565 }
566 } else if (comptime std.mem.eql(u8, fmt, "b")) {566 } else if (comptime std.mem.eql(u8, fmt, "b")) {
567 radix = 2;567 radix = 2;
...@@ -657,7 +657,7 @@ pub fn formatUnicodeCodepoint(...@@ -657,7 +657,7 @@ pub fn formatUnicodeCodepoint(
657 if (unicode.utf8ValidCodepoint(c)) {657 if (unicode.utf8ValidCodepoint(c)) {
658 var buf: [4]u8 = undefined;658 var buf: [4]u8 = undefined;
659 // The codepoint is surely valid, hence the use of unreachable659 // The codepoint is surely valid, hence the use of unreachable
660 const len = std.unicode.utf8Encode(@truncate(u21, c), &buf) catch |err| switch (err) {660 const len = std.unicode.utf8Encode(c, &buf) catch |err| switch (err) {
661 error.Utf8CannotEncodeSurrogateHalf, error.CodepointTooLarge => unreachable,661 error.Utf8CannotEncodeSurrogateHalf, error.CodepointTooLarge => unreachable,
662 };662 };
663 return formatBuf(buf[0..len], options, writer);663 return formatBuf(buf[0..len], options, writer);