authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-04-27 15:38:21+10:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-27 11:18:53-04:00
logbc1840e18f5456e3f9cc1f9c62e932e90ebb0d36
tree0d58c2a0cda99346a537b9bbb03e5b0361d16b8c
parent66f3ef06e83311662afa490abcbf97c3e272aeab

Revert "std: Add mem.nativeIntToBig and mem.nativeIntToLittle"

This reverts commit 211f0a2226db7c53cfa1581c5572a6100c3e17f6. The functions `mem.nativeToBig` and `mem.nativeToLittle` already existed.

1 files changed, 0 insertions(+), 16 deletions(-)

std/mem.zig-16
...@@ -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}
756756
757pub 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
765pub 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
773pub fn hash_slice_u8(k: []const u8) u32 {757pub fn hash_slice_u8(k: []const u8) u32 {
774 // FNV 32-bit hash758 // FNV 32-bit hash
775 var h: u32 = 2166136261;759 var h: u32 = 2166136261;