summaryrefslogtreecommitdiff
path: root/codegen/dwp.zig
diff options
context:
space:
mode:
Diffstat (limited to 'codegen/dwp.zig')
-rw-r--r--codegen/dwp.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/codegen/dwp.zig b/codegen/dwp.zig
index c581eb6..5e5bf6a 100644
--- a/codegen/dwp.zig
+++ b/codegen/dwp.zig
@@ -4,7 +4,7 @@ const builtin = @import("builtin");
4const options = @import("options"); 4const options = @import("options");
5 5
6const block_size = 256; 6const block_size = 256;
7const Block = [block_size]i3; 7const Block = [block_size]i4;
8 8
9const BlockMap = std.HashMap( 9const BlockMap = std.HashMap(
10 Block, 10 Block,
@@ -17,7 +17,7 @@ const BlockMap = std.HashMap(
17 } 17 }
18 18
19 pub fn eql(_: @This(), a: Block, b: Block) bool { 19 pub fn eql(_: @This(), a: Block, b: Block) bool {
20 return std.mem.eql(i3, &a, &b); 20 return std.mem.eql(i4, &a, &b);
21 } 21 }
22 }, 22 },
23 std.hash_map.default_max_load_percentage, 23 std.hash_map.default_max_load_percentage,
@@ -28,7 +28,7 @@ pub fn main() !void {
28 defer arena.deinit(); 28 defer arena.deinit();
29 const allocator = arena.allocator(); 29 const allocator = arena.allocator();
30 30
31 var flat_map = std.AutoHashMap(u21, i3).init(allocator); 31 var flat_map = std.AutoHashMap(u21, i4).init(allocator);
32 defer flat_map.deinit(); 32 defer flat_map.deinit();
33 33
34 var line_buf: [4096]u8 = undefined; 34 var line_buf: [4096]u8 = undefined;
@@ -147,10 +147,10 @@ pub fn main() !void {
147 var stage1 = std.ArrayList(u16).init(allocator); 147 var stage1 = std.ArrayList(u16).init(allocator);
148 defer stage1.deinit(); 148 defer stage1.deinit();
149 149
150 var stage2 = std.ArrayList(i3).init(allocator); 150 var stage2 = std.ArrayList(i4).init(allocator);
151 defer stage2.deinit(); 151 defer stage2.deinit();
152 152
153 var block: Block = [_]i3{0} ** block_size; 153 var block: Block = [_]i4{0} ** block_size;
154 var block_len: u16 = 0; 154 var block_len: u16 = 0;
155 155
156 for (0..0x110000) |i| { 156 for (0..0x110000) |i| {
@@ -163,8 +163,8 @@ pub fn main() !void {
163 0x2e3b => width = 3, 163 0x2e3b => width = 3,
164 164
165 // C0/C1 control codes 165 // C0/C1 control codes
166 0...0x20, 166 0...0x20 => width = if (options.c0_width) |c0| c0 else 0,
167 0x80...0xa0, 167 0x80...0x9f => width = if (options.c1_width) |c1| c1 else 0,
168 168
169 // Line separator 169 // Line separator
170 0x2028, 170 0x2028,
@@ -204,7 +204,7 @@ pub fn main() !void {
204 if (cp == 0xad) width = 1; 204 if (cp == 0xad) width = 1;
205 205
206 // Backspace and delete 206 // Backspace and delete
207 if (cp == 0x8 or cp == 0x7f) width = -1; 207 if (cp == 0x8 or cp == 0x7f) width = if (options.c0_width) |c0| c0 else -1;
208 208
209 // Process block 209 // Process block
210 block[block_len] = width; 210 block[block_len] = width;