| ... | @@ -754,22 +754,6 @@ test "writeIntBig and writeIntLittle" { | ... | @@ -754,22 +754,6 @@ test "writeIntBig and writeIntLittle" { |
| 754 | testing.expect(eql_slice_u8(buf2[0..], []u8{ 0xfc, 0xff })); | 754 | testing.expect(eql_slice_u8(buf2[0..], []u8{ 0xfc, 0xff })); |
| 755 | } | 755 | } |
| 756 | | 756 | |
| 757 | pub fn nativeIntToBig(comptime T: type, x: T) T { | | |
| 758 | comptime assert(T.bit_count % 8 == 0); | | |
| 759 | switch (builtin.endian) { | | |
| 760 | builtin.Endian.Little => return @bswap(T, x), | | |
| 761 | builtin.Endian.Big => return x, | | |
| 762 | } | | |
| 763 | } | | |
| 764 | | | |
| 765 | pub fn nativeIntToLittle(comptime T: type, x: T) T { | | |
| 766 | comptime assert(T.bit_count % 8 == 0); | | |
| 767 | switch (builtin.endian) { | | |
| 768 | builtin.Endian.Little => return x, | | |
| 769 | builtin.Endian.Big => return @bswap(T, x), | | |
| 770 | } | | |
| 771 | } | | |
| 772 | | | |
| 773 | pub fn hash_slice_u8(k: []const u8) u32 { | 757 | pub fn hash_slice_u8(k: []const u8) u32 { |
| 774 | // FNV 32-bit hash | 758 | // FNV 32-bit hash |
| 775 | var h: u32 = 2166136261; | 759 | var h: u32 = 2166136261; |