@@ 92,10 92,9 @@ pub const Reader = struct {
}
fn readFloat(self: *Self, comptime T: type, reader: anytype) !T {
- const type_info = @typeInfo(T);
- return switch (type_info.Float.bits) {
- 32 => @bitCast(T, try reader.readIntLittle(u32)),
- 64 => @bitCast(T, try reader.readIntLittle(u64)),
+ const bits = @typeInfo(T).Float.bits;
+ return switch (bits) {
+ 32, 64 => @bitCast(T, try reader.readIntLittle(meta.Int(.unsigned, bits))),
else => @compileError("unsupported float type " ++ @typeName(T)),
};
}