| author | |
| committer | |
| log | e89d6fc5037f4271396cb6acf3488f158aaacbae |
| tree | f0d4bd09094b60e6df24db416029f52f87a853f5 |
| parent | 107d4f668342cce492150ef8763f56008058f0bc |
3 files changed, 13 insertions(+), 3 deletions(-)
lib/std/math/big/int.zig+2-2| ... | ... | @@ -340,7 +340,7 @@ pub const Mutable = struct { |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | const req_limbs = calcTwosCompLimbCount(bit_count); |
| 343 | const bit = @as(Log2Limb, @truncate(bit_count - 1)); | |
| 343 | const bit: Log2Limb = @truncate(bit_count - 1); | |
| 344 | 344 | const signmask = @as(Limb, 1) << bit; // 0b0..010..0 where 1 is the sign bit. |
| 345 | 345 | const mask = (signmask << 1) -% 1; // 0b0..011..1 where the leftmost 1 is the sign bit. |
| 346 | 346 | |
| ... | ... | @@ -2186,7 +2186,7 @@ pub const Const = struct { |
| 2186 | 2186 | return if (self.positive) @as(T, @intCast(r)) else error.NegativeIntoUnsigned; |
| 2187 | 2187 | } else { |
| 2188 | 2188 | if (self.positive) { |
| 2189 | return @as(T, @intCast(r)); | |
| 2189 | return @intCast(r); | |
| 2190 | 2190 | } else { |
| 2191 | 2191 | if (math.cast(T, r)) |ok| { |
| 2192 | 2192 | return -ok; |
src/type.zig+1-1| ... | ... | @@ -1545,7 +1545,7 @@ pub const Type = struct { |
| 1545 | 1545 | 0 => .none, |
| 1546 | 1546 | 1...8 => .@"1", |
| 1547 | 1547 | 9...16 => .@"2", |
| 1548 | 17...127 => .@"4", | |
| 1548 | 17...64 => .@"4", | |
| 1549 | 1549 | else => .@"16", |
| 1550 | 1550 | }, |
| 1551 | 1551 | .x86_64 => switch (bits) { |
test/behavior/error.zig+10| ... | ... | @@ -1077,3 +1077,13 @@ test "result location initialization of error union with OPV payload" { |
| 1077 | 1077 | _ = &c; |
| 1078 | 1078 | try expectEqual(0, (c catch return error.TestFailed).x); |
| 1079 | 1079 | } |
| 1080 | ||
| 1081 | test "return error union with i65" { | |
| 1082 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 1083 | ||
| 1084 | try expect(try add(1000, 234) == 1234); | |
| 1085 | } | |
| 1086 | ||
| 1087 | fn add(x: i65, y: i65) anyerror!i65 { | |
| 1088 | return x + y; | |
| 1089 | } |