diff options
| author | 2026-02-04 18:36:18 -0500 | |
|---|---|---|
| committer | 2026-02-04 18:36:18 -0500 | |
| commit | e476250ea9326b2550847b301c265115ff375a31 (patch) | |
| tree | cf627ced47cecce80020b7a1f30aa51852c0c59b /codegen/numeric.zig | |
| parent | Normalization and case folding (diff) | |
| download | zg-e476250ea9326b2550847b301c265115ff375a31.tar.gz zg-e476250ea9326b2550847b301c265115ff375a31.tar.xz zg-e476250ea9326b2550847b301c265115ff375a31.zip | |
Rest of the 'easy' stuff
This gets us up to feature parity with Jacob's work. I want to
eliminate that last allocation using the comptime hash map, and then
see about eliminating allocations from case comparisons as well.
That should just about do it.
Diffstat (limited to 'codegen/numeric.zig')
| -rw-r--r-- | codegen/numeric.zig | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/codegen/numeric.zig b/codegen/numeric.zig index b304349..e7b4861 100644 --- a/codegen/numeric.zig +++ b/codegen/numeric.zig | |||
| @@ -123,12 +123,24 @@ pub fn main() anyerror!void { | |||
| 123 | defer out_file.close(); | 123 | defer out_file.close(); |
| 124 | var writer = out_file.writer(&write_buf); | 124 | var writer = out_file.writer(&write_buf); |
| 125 | 125 | ||
| 126 | const endian = builtin.cpu.arch.endian(); | 126 | try writer.interface.print( |
| 127 | try writer.interface.writeInt(u16, @intCast(stage1.items.len), endian); | 127 | \\//! This file is auto-generated. Do not edit. |
| 128 | for (stage1.items) |i| try writer.interface.writeInt(u16, i, endian); | 128 | \\ |
| 129 | 129 | \\pub const s1: [{}]u16 = .{{ | |
| 130 | try writer.interface.writeInt(u16, @intCast(stage2.items.len), endian); | 130 | , .{stage1.items.len}); |
| 131 | try writer.interface.writeAll(stage2.items); | 131 | for (stage1.items) |entry| try writer.interface.print("{}, ", .{entry}); |
| 132 | |||
| 133 | try writer.interface.print( | ||
| 134 | \\ | ||
| 135 | \\}}; | ||
| 136 | \\ | ||
| 137 | \\pub const s2: [{}]u8 = .{{ | ||
| 138 | , .{stage2.items.len}); | ||
| 139 | for (stage2.items) |entry| try writer.interface.print("{}, ", .{entry}); | ||
| 140 | |||
| 141 | try writer.interface.writeAll( | ||
| 142 | \\}; | ||
| 143 | ); | ||
| 132 | 144 | ||
| 133 | try writer.interface.flush(); | 145 | try writer.interface.flush(); |
| 134 | } | 146 | } |