authorgravatar for lewis.gaul@gmail.comLewis Gaul <lewis.gaul@gmail.com> 2021-11-21 21:27:51+00:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-22 21:30:20-05:00
logbc3e86c4b7e595eab9951a847c6637bb8f2a7451
tree39f5108635f169b6d6635d26e6ca91ceaf208643
parent11330cbcc55f7d7dbd2de2f5acd7b097cd19788c

Add std.meta.Float, alongside std.meta.Int


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

lib/std/meta.zig+13
......@@ -866,6 +866,19 @@ pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16)
866866 });
867867}
868868
869pub fn Float(comptime bit_count: u8) type {
870 return @Type(TypeInfo{
871 .Float = .{ .bits = bit_count },
872 });
873}
874
875test "std.meta.Float" {
876 try testing.expectEqual(f16, Float(16));
877 try testing.expectEqual(f32, Float(32));
878 try testing.expectEqual(f64, Float(64));
879 try testing.expectEqual(f128, Float(128));
880}
881
869882pub fn Vector(comptime len: u32, comptime child: type) type {
870883 return @Type(TypeInfo{
871884 .Vector = .{