| ... | @@ -269,14 +269,7 @@ pub const Utf8Iterator = struct { | ... | @@ -269,14 +269,7 @@ pub const Utf8Iterator = struct { |
| 269 | | 269 | |
| 270 | pub fn nextCodepoint(it: *Utf8Iterator) ?u21 { | 270 | pub fn nextCodepoint(it: *Utf8Iterator) ?u21 { |
| 271 | const slice = it.nextCodepointSlice() orelse return null; | 271 | const slice = it.nextCodepointSlice() orelse return null; |
| 272 | | 272 | return utf8Decode(slice) catch unreachable; |
| 273 | switch (slice.len) { | | |
| 274 | 1 => return @as(u21, slice[0]), | | |
| 275 | 2 => return utf8Decode2(slice) catch unreachable, | | |
| 276 | 3 => return utf8Decode3(slice) catch unreachable, | | |
| 277 | 4 => return utf8Decode4(slice) catch unreachable, | | |
| 278 | else => unreachable, | | |
| 279 | } | | |
| 280 | } | 273 | } |
| 281 | | 274 | |
| 282 | /// Look ahead at the next n codepoints without advancing the iterator. | 275 | /// Look ahead at the next n codepoints without advancing the iterator. |