aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted/value.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src-self-hosted/value.zig')
-rw-r--r--src-self-hosted/value.zig36
1 files changed, 29 insertions, 7 deletions
diff --git a/src-self-hosted/value.zig b/src-self-hosted/value.zig
index f2e36b59a4..6a39371ebe 100644
--- a/src-self-hosted/value.zig
+++ b/src-self-hosted/value.zig
@@ -65,6 +65,7 @@ pub const Value = extern union {
undef,
zero,
+ one,
void_value,
unreachable_value,
empty_array,
@@ -174,6 +175,7 @@ pub const Value = extern union {
.anyframe_type,
.undef,
.zero,
+ .one,
.void_value,
.unreachable_value,
.empty_array,
@@ -313,6 +315,7 @@ pub const Value = extern union {
.null_value => return out_stream.writeAll("null"),
.undef => return out_stream.writeAll("undefined"),
.zero => return out_stream.writeAll("0"),
+ .one => return out_stream.writeAll("1"),
.void_value => return out_stream.writeAll("{}"),
.unreachable_value => return out_stream.writeAll("unreachable"),
.bool_true => return out_stream.writeAll("true"),
@@ -447,6 +450,7 @@ pub const Value = extern union {
.undef,
.zero,
+ .one,
.void_value,
.unreachable_value,
.empty_array,
@@ -546,7 +550,9 @@ pub const Value = extern union {
.bool_false,
=> return BigIntMutable.init(&space.limbs, 0).toConst(),
- .bool_true => return BigIntMutable.init(&space.limbs, 1).toConst(),
+ .one,
+ .bool_true,
+ => return BigIntMutable.init(&space.limbs, 1).toConst(),
.int_u64 => return BigIntMutable.init(&space.limbs, self.cast(Payload.Int_u64).?.int).toConst(),
.int_i64 => return BigIntMutable.init(&space.limbs, self.cast(Payload.Int_i64).?.int).toConst(),
@@ -627,7 +633,9 @@ pub const Value = extern union {
.bool_false,
=> return 0,
- .bool_true => return 1,
+ .one,
+ .bool_true,
+ => return 1,
.int_u64 => return self.cast(Payload.Int_u64).?.int,
.int_i64 => return @intCast(u64, self.cast(Payload.Int_i64).?.int),
@@ -708,7 +716,9 @@ pub const Value = extern union {
.bool_false,
=> return 0,
- .bool_true => return 1,
+ .one,
+ .bool_true,
+ => return 1,
.int_u64 => return @intCast(i64, self.cast(Payload.Int_u64).?.int),
.int_i64 => return self.cast(Payload.Int_i64).?.int,
@@ -734,6 +744,7 @@ pub const Value = extern union {
.float_128 => @floatCast(T, self.cast(Payload.Float_128).?.val),
.zero => 0,
+ .one => 1,
.int_u64 => @intToFloat(T, self.cast(Payload.Int_u64).?.int),
.int_i64 => @intToFloat(T, self.cast(Payload.Int_i64).?.int),
@@ -814,7 +825,9 @@ pub const Value = extern union {
.bool_false,
=> return 0,
- .bool_true => return 1,
+ .one,
+ .bool_true,
+ => return 1,
.int_u64 => {
const x = self.cast(Payload.Int_u64).?.int;
@@ -900,7 +913,9 @@ pub const Value = extern union {
.bool_false,
=> return true,
- .bool_true => {
+ .one,
+ .bool_true,
+ => {
const info = ty.intInfo(target);
if (info.signed) {
return info.bits >= 2;
@@ -1064,7 +1079,9 @@ pub const Value = extern union {
.@"error",
=> unreachable,
- .zero => false,
+ .zero,
+ .one,
+ => false,
.float_16 => @rem(self.cast(Payload.Float_16).?.val, 1) != 0,
.float_32 => @rem(self.cast(Payload.Float_32).?.val, 1) != 0,
@@ -1140,7 +1157,9 @@ pub const Value = extern union {
.bool_false,
=> .eq,
- .bool_true => .gt,
+ .one,
+ .bool_true,
+ => .gt,
.int_u64 => std.math.order(lhs.cast(Payload.Int_u64).?.int, 0),
.int_i64 => std.math.order(lhs.cast(Payload.Int_i64).?.int, 0),
@@ -1257,6 +1276,7 @@ pub const Value = extern union {
.enum_literal_type,
.anyframe_type,
.zero,
+ .one,
.bool_true,
.bool_false,
.null_value,
@@ -1339,6 +1359,7 @@ pub const Value = extern union {
.enum_literal_type,
.anyframe_type,
.zero,
+ .one,
.bool_true,
.bool_false,
.null_value,
@@ -1438,6 +1459,7 @@ pub const Value = extern union {
.enum_literal_type,
.anyframe_type,
.zero,
+ .one,
.empty_array,
.bool_true,
.bool_false,