Skip to content

Commit 55d6252

Browse files
committed
fix to make defaultEql work with other types than u8 lol
1 parent d60e6d1 commit 55d6252

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/std/static_string_map.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub fn StaticStringMapIgnoreCase(comptime V: type) type {
1313

1414
pub fn defaultEql(comptime len: usize, comptime expected: anytype, actual: anytype) bool {
1515
comptime assert(std.meta.hasUniqueRepresentation(@TypeOf(expected, actual)));
16-
const Compare = std.meta.Int(.unsigned, len * std.mem.byte_size_in_bits);
16+
const T = @typeInfo(@TypeOf(expected)).array.child;
17+
const child_bytes = std.mem.byte_size_in_bits * @sizeOf(T);
18+
const Compare = std.meta.Int(.unsigned, len * child_bytes);
1719
const a: Compare = @bitCast(expected);
1820
const b: Compare = @bitCast(actual);
1921
return a == b;

0 commit comments

Comments
 (0)