authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-01 03:49:35 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-01 03:49:35 -07:00
log427cef6d15f4eeb921555d237c8096382a098d4a
tree2b9cf44c8e228e95e7a40f637b4b17c57df36dc7
parenta61663d2e573c2295e180fa1333accbd7256acd9
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

move data_soa into ucd


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

normalization.zig+10-10
......@@ -4,9 +4,9 @@ const std = @import("std");
44const extras = @import("extras");
55const ucd = @import("unicode-ucd");
66
7const data = extras.StaticMultiList(ucd.unicode_data.Codepoint).initComptime(&ucd.unicode_data.data);
7const ucd_data_soa = ucd.unicode_data.data_soa;
88const data_first_gap = blk: {
9 for (data.items[0], 0..) |cp, i| {
9 for (ucd_data_soa[0], 0..) |cp, i| {
1010 if (cp != i) {
1111 break :blk i;
1212 }
......@@ -50,16 +50,16 @@ fn Decomposition(map: *extras.ManyArrayList(u8), kind: enum { canonical, compati
5050 while (n < map.lengths.items.len) : (n += 1) {
5151 const sl = map.items(n);
5252 const cp = std.unicode.utf8Decode(sl) catch unreachable;
53 if (std.sort.binarySearch(u21, data.items[0], cp, extras.compareFnBasic(u21))) |j| {
54 if (data.items[5][j] == .__none) continue;
55 if ((data.items[5][j] == .__canonical) != (kind == .canonical)) continue;
53 if (std.sort.binarySearch(u21, ucd_data_soa[0], cp, extras.compareFnBasic(u21))) |j| {
54 if (ucd_data_soa[5][j] == .__none) continue;
55 if ((ucd_data_soa[5][j] == .__canonical) != (kind == .canonical)) continue;
5656 map.remove(n);
57 for (data.items[6][j], 0..) |ktem, k| {
57 for (ucd_data_soa[6][j], 0..) |ktem, k| {
5858 var buf: [4]u8 = undefined;
5959 const l = std.unicode.utf8Encode(ktem, &buf) catch unreachable;
6060 try map.insertAt(n + k, buf[0..l]);
6161 }
62 n += data.items[6][j].len - 1;
62 n += ucd_data_soa[6][j].len - 1;
6363 }
6464 }
6565 // sort non-starters with respect to canonical ordering
......@@ -189,10 +189,10 @@ fn CanonicalComposition(map: *extras.ManyArrayList(u8)) !void {
189189
190190pub fn cpCCC(cp: u21) u8 {
191191 if (cp < data_first_gap) {
192 return data.items[3][cp];
192 return ucd_data_soa[3][cp];
193193 }
194 if (std.sort.binarySearch(u21, data.items[0], cp, extras.compareFnBasic(u21))) |idx| {
195 return data.items[3][idx];
194 if (std.sort.binarySearch(u21, ucd_data_soa[0], cp, extras.compareFnBasic(u21))) |idx| {
195 return ucd_data_soa[3][idx];
196196 }
197197 // TODO: this happens to be correct but ucd.unicode_data needs to detect the block ranges
198198 return 0;