aboutsummaryrefslogtreecommitdiff
path: root/src/AstGen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-04-12 21:46:20 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-04-15 19:06:39 -0700
commit6dba9bc6fc6741e51af86f71e3057cffed7406a6 (patch)
tree14f01a271c9e633769804f8b86f7687f838c5aca /src/AstGen.zig
parentdf983b30d2b890e21fba214145ccc4f4a263359d (diff)
downloadzig-6dba9bc6fc6741e51af86f71e3057cffed7406a6.tar.gz
zig-6dba9bc6fc6741e51af86f71e3057cffed7406a6.zip
stage2: implement `@bitSizeOf`
Diffstat (limited to 'src/AstGen.zig')
-rw-r--r--src/AstGen.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 0830b95e77..f5a5b22645 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -1360,6 +1360,7 @@ fn blockExprStmts(
.enum_to_int,
.type_info,
.size_of,
+ .bit_size_of,
=> break :b false,
// ZIR instructions that are always either `noreturn` or `void`.
@@ -4349,6 +4350,12 @@ fn builtinCall(
return rvalue(gz, scope, rl, result, node);
},
+ .bit_size_of => {
+ const operand = try typeExpr(gz, scope, params[0]);
+ const result = try gz.addUnNode(.bit_size_of, operand, node);
+ return rvalue(gz, scope, rl, result, node);
+ },
+
.add_with_overflow,
.align_cast,
.align_of,
@@ -4357,7 +4364,6 @@ fn builtinCall(
.atomic_store,
.bit_offset_of,
.bool_to_int,
- .bit_size_of,
.mul_add,
.byte_swap,
.bit_reverse,