mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 06:24:44 +01:00
std.mem.byteSwapAllFields: support slices
This commit is contained in:
parent
1ee403ce93
commit
1e1f026c83
1 changed files with 4 additions and 2 deletions
|
|
@ -1714,7 +1714,7 @@ pub fn readVarInt(comptime ReturnType: type, bytes: []const u8, endian: Endian)
|
|||
}
|
||||
},
|
||||
}
|
||||
return @as(ReturnType, @truncate(result));
|
||||
return @truncate(result);
|
||||
}
|
||||
|
||||
test readVarInt {
|
||||
|
|
@ -2196,7 +2196,9 @@ pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {
|
|||
}
|
||||
}
|
||||
},
|
||||
else => @compileError("byteSwapAllFields expects a struct or array as the first argument"),
|
||||
else => {
|
||||
ptr.* = @byteSwap(ptr.*);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue