authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-09 20:36:33 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-09 20:36:33 -07:00
logf7dff19f70cb267337139a74978a255b8bdee694
tree675d35328b4f1c41ccc5d739a2b94b2c98a99b19
parent5fc8936866ce781c435d191c986d7c185072dc4f

readType: short circuit if type is u8, single bytes dont have endianness


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

src/lib.zig+1
......@@ -377,6 +377,7 @@ pub fn hashBytes(comptime Algo: type, bytes: []const u8) [Algo.digest_length]u8
377377}
378378
379379pub fn readType(reader: anytype, comptime T: type, endian: std.builtin.Endian) !T {
380 if (T == u8) return reader.readByte(); // single bytes dont have an endianness
380381 return switch (@typeInfo(T)) {
381382 .Struct => |t| {
382383 switch (t.layout) {