Skip to content

Commit 3a1f515

Browse files
committed
Address review comments
1 parent 1982e0c commit 3a1f515

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/std/fmt.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ pub fn formatIntValue(
561561
if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) {
562562
return formatUnicodeCodepoint(@as(u21, int_value), options, writer);
563563
} 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");
565565
}
566566
} else if (comptime std.mem.eql(u8, fmt, "b")) {
567567
radix = 2;
@@ -657,7 +657,7 @@ pub fn formatUnicodeCodepoint(
657657
if (unicode.utf8ValidCodepoint(c)) {
658658
var buf: [4]u8 = undefined;
659659
// 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) {
661661
error.Utf8CannotEncodeSurrogateHalf, error.CodepointTooLarge => unreachable,
662662
};
663663
return formatBuf(buf[0..len], options, writer);

0 commit comments

Comments
 (0)