fix: bug hunt
This commit is contained in:
@@ -64,7 +64,7 @@ init func($V type, $N usize, $entries [N]Pair(V)) StaticStringMap(V) {
|
||||
max_len u32 :: u32(keys[N - 1].len)
|
||||
len_indexes [usize(max_len) + 1]mut u32 = undefined
|
||||
entry_index usize = 0
|
||||
for 0..=(usize(max_len)) |length| {
|
||||
for 0..=usize(max_len) |length| {
|
||||
while entry_index < N and keys[entry_index].len < length : entry_index += 1 {}
|
||||
len_indexes[length] = u32(entry_index)
|
||||
}
|
||||
@@ -90,4 +90,5 @@ get func($V type, map @StaticStringMap(V), key []u8) ?V {
|
||||
if (candidate.len != key.len) return null
|
||||
if mem.eql(u8, candidate, key) return map.values[idx]
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user