aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorJan Prudil <57442prudil@sstebrno.eu>2020-10-17 14:09:59 +0200
committerJan Prudil <57442prudil@sstebrno.eu>2020-10-17 14:09:59 +0200
commitaadccc4206ea605719de789bc7c9c48557d02331 (patch)
tree631f4d25f6c8bf6cefdcbe58f3ac9f61434b6402 /lib/std/meta.zig
parent245d98d32dd29e80de9732f415a4731748008acf (diff)
downloadzig-aadccc4206ea605719de789bc7c9c48557d02331.tar.gz
zig-aadccc4206ea605719de789bc7c9c48557d02331.zip
Make std.meta.Int accept a signedness parameter
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index ca13ba8a28..f02055a7ab 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -678,10 +678,15 @@ pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const De
/// Deprecated: use Int
pub const IntType = Int;
-pub fn Int(comptime is_signed: bool, comptime bit_count: u16) type {
+pub const Signedness = enum {
+ unsigned,
+ signed,
+};
+
+pub fn Int(comptime signedness: Signedness, comptime bit_count: u16) type {
return @Type(TypeInfo{
.Int = .{
- .is_signed = is_signed,
+ .is_signed = signedness == .signed,
.bits = bit_count,
},
});