diff --git a/doc/langref.html.in b/doc/langref.html.in index f820a05b698f777db5d1b79c642b452057f89825..c1a6160e04c39d5373ed7f15174407768b2976f8 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -5313,7 +5313,7 @@ comptime { {#header_close#} {#header_open|@bswap#} -
{#syntax#}@swap(comptime T: type, value: T) T{#endsyntax#}
+
{#syntax#}@bswap(comptime T: type, value: T) T{#endsyntax#}

{#syntax#}T{#endsyntax#} must be an integer type with bit count evenly divisible by 8.

Swaps the byte order of the integer. This converts a big endian integer to a little endian integer, diff --git a/std/io.zig b/std/io.zig index 444219171779b0033aad6a091c1291068f80a53e..8d33dfc5ea0240f922ecb377fa866662b526d6da 100644 --- a/std/io.zig +++ b/std/io.zig @@ -186,7 +186,7 @@ pub fn InStream(comptime ReadError: type) type { pub fn readVarInt(self: *Self, comptime T: type, endian: builtin.Endian, size: usize) !T { assert(size <= @sizeOf(T)); var bytes: [@sizeOf(T)]u8 = undefined; - try self.readNoEof(bytes[0..]); + try self.readNoEof(bytes[0..size]); return mem.readIntSlice(T, bytes, endian); }