diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2018-12-19 17:48:21 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2018-12-19 17:48:21 -0500 |
| commit | 8768816d69ddf3253d2598923643f390cc18082c (patch) | |
| tree | 8e2962aa68bacc59a0253a9d039759b20de639b0 /std | |
| parent | a7670e80a49021fb96d1f9a1bbcbcfc6c1e835ab (diff) | |
| download | zig-8768816d69ddf3253d2598923643f390cc18082c.tar.gz zig-8768816d69ddf3253d2598923643f390cc18082c.zip | |
std.io: call the idiomatic std.mem.readInt functions
I originally called the Slice variants to work around
comptime code not supporting `@ptrCast`, but I fixed that
in 757d0665 so now the workaround is no longer needed.
Diffstat (limited to 'std')
| -rw-r--r-- | std/io.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/std/io.zig b/std/io.zig index c40ededc00..428d95725d 100644 --- a/std/io.zig +++ b/std/io.zig @@ -155,32 +155,32 @@ pub fn InStream(comptime ReadError: type) type { pub fn readIntNative(self: *Self, comptime T: type) !T { var bytes: [@sizeOf(T)]u8 = undefined; try self.readNoEof(bytes[0..]); - return mem.readIntSliceNative(T, bytes); + return mem.readIntNative(T, &bytes); } /// Reads a foreign-endian integer pub fn readIntForeign(self: *Self, comptime T: type) !T { var bytes: [@sizeOf(T)]u8 = undefined; try self.readNoEof(bytes[0..]); - return mem.readIntSliceForeign(T, bytes); + return mem.readIntForeign(T, &bytes); } pub fn readIntLittle(self: *Self, comptime T: type) !T { var bytes: [@sizeOf(T)]u8 = undefined; try self.readNoEof(bytes[0..]); - return mem.readIntSliceLittle(T, bytes); + return mem.readIntLittle(T, &bytes); } pub fn readIntBig(self: *Self, comptime T: type) !T { var bytes: [@sizeOf(T)]u8 = undefined; try self.readNoEof(bytes[0..]); - return mem.readIntSliceBig(T, bytes); + return mem.readIntBig(T, &bytes); } pub fn readInt(self: *Self, comptime T: type, endian: builtin.Endian) !T { var bytes: [@sizeOf(T)]u8 = undefined; try self.readNoEof(bytes[0..]); - return mem.readIntSlice(T, bytes, endian); + return mem.readInt(T, &bytes, endian); } pub fn readVarInt(self: *Self, comptime ReturnType: type, endian: builtin.Endian, size: usize) !ReturnType { |
