authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-05-11 01:26:54 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-05-11 01:26:54 -07:00
log9408f47cf5ebace4bc0931d7216b20f38563b45e
tree153519dd678ce4f9daa6c8f9e2d0cac3bca6552a
parent704861215f786c2189335713b7d211ac2837e2ad

upgrade to zig 0.14


1 files changed, 3 insertions(+), 6 deletions(-)

mod.zig+3-6
...@@ -14,16 +14,13 @@ pub const Codepoints = union(enum) {...@@ -14,16 +14,13 @@ pub const Codepoints = union(enum) {
1414
15pub const ENTITIES = @import("entities.zig").ENTITIES;15pub const ENTITIES = @import("entities.zig").ENTITIES;
1616
17fn order(_: void, lhs: Entity, rhs: Entity) std.math.Order {17fn compare(lhs: Entity, rhs: Entity) std.math.Order {
18 return std.mem.order(u8, lhs.entity, rhs.entity);18 return std.mem.order(u8, lhs.entity, rhs.entity);
19}19}
2020
21pub fn lookup(entity: []const u8) ?Entity {21pub fn lookup(entity: []const u8) ?Entity {
22 const maybe_index = std.sort.binarySearch(Entity, Entity{22 const context: Entity = .{ .entity = entity, .codepoints = .{ .Single = 0 }, .characters = "" };
23 .entity = entity,23 const maybe_index = std.sort.binarySearch(Entity, &ENTITIES, context, compare);
24 .codepoints = .{ .Single = 0 },
25 .characters = "",
26 }, ENTITIES[0..], {}, order);
2724
28 if (maybe_index) |index| {25 if (maybe_index) |index| {
29 return ENTITIES[index];26 return ENTITIES[index];