aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-03-16 21:22:02 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-16 23:18:35 -0700
commit79d3780fbda475a50d6e0ca53d51c9e7c7690ab1 (patch)
treec500f3c426116267f37fdb0a567bb8de282fa199 /src
parent1af51a083383be5bbb3249c24e00326aff935122 (diff)
downloadzig-79d3780fbda475a50d6e0ca53d51c9e7c7690ab1.tar.gz
zig-79d3780fbda475a50d6e0ca53d51c9e7c7690ab1.zip
stage2: bit_not on u0 is always 0
Diffstat (limited to 'src')
-rw-r--r--src/value.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/value.zig b/src/value.zig
index d63452ee56..005f1f1ffd 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -2977,6 +2977,11 @@ pub const Value = extern union {
const info = ty.intInfo(target);
+ if (info.bits == 0) {
+ assert(val.isZero()); // Sema should guarantee
+ return val;
+ }
+
// TODO is this a performance issue? maybe we should try the operation without
// resorting to BigInt first.
var val_space: Value.BigIntSpace = undefined;