This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const mem = std.mem; | |
const Foo = struct { | |
string_bytes: std.ArrayListUnmanaged(u8), | |
/// Key is string_bytes index. | |
string_table: std.HashMapUnmanaged(u32, void, IndexContext, std.hash_map.default_max_load_percentage), | |
}; | |
const IndexContext = struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Fast functions for working with binary data | |
return { | |
decode_uint8 = function(str, ofs) | |
ofs = ofs or 0 | |
return string.byte(str, ofs + 1) | |
end, | |
decode_uint16 = function(str, ofs) | |
ofs = ofs or 0 | |
local a, b = string.byte(str, ofs + 1, ofs + 2) |