| ... | @@ -377,6 +377,7 @@ pub fn hashBytes(comptime Algo: type, bytes: []const u8) [Algo.digest_length]u8 | ... | @@ -377,6 +377,7 @@ pub fn hashBytes(comptime Algo: type, bytes: []const u8) [Algo.digest_length]u8 |
| 377 | } | 377 | } |
| 378 | | 378 | |
| 379 | pub fn readType(reader: anytype, comptime T: type, endian: std.builtin.Endian) !T { | 379 | pub 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 |
| 380 | return switch (@typeInfo(T)) { | 381 | return switch (@typeInfo(T)) { |
| 381 | .Struct => |t| { | 382 | .Struct => |t| { |
| 382 | switch (t.layout) { | 383 | switch (t.layout) { |