Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ziglang/zig
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f50c0c664f3b
Choose a base ref
...
head repository: ziglang/zig
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 47dd1049c8ef
Choose a head ref
  • 4 commits
  • 3 files changed
  • 2 contributors

Commits on Jun 21, 2018

  1. Copy the full SHA
    0ab4afb View commit details
  2. Fix logic

    isaachier committed Jun 21, 2018
    Copy the full SHA
    eeda1a1 View commit details
  3. Add test case

    isaachier committed Jun 21, 2018
    Copy the full SHA
    f1207a8 View commit details
  4. Merge pull request #1145 from isaachier/bigint-neg-one-incr-fix

    Fix bigint -1 increment operation
    andrewrk authored Jun 21, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    47dd104 View commit details
Showing with 22 additions and 4 deletions.
  1. +9 −4 src/bigint.cpp
  2. +1 −0 test/behavior.zig
  3. +12 −0 test/cases/bugs/1111.zig
13 changes: 9 additions & 4 deletions src/bigint.cpp
Original file line number Diff line number Diff line change
@@ -1683,10 +1683,15 @@ void bigint_incr(BigInt *x) {
bigint_init_unsigned(x, 1);
return;
}

if (x->digit_count == 1 && x->data.digit != UINT64_MAX) {
x->data.digit += 1;
return;

if (x->digit_count == 1) {
if (x->is_negative && x->data.digit != 0) {
x->data.digit -= 1;
return;
} else if (!x->is_negative && x->data.digit != UINT64_MAX) {
x->data.digit += 1;
return;
}
}

BigInt copy;
1 change: 1 addition & 0 deletions test/behavior.zig
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ comptime {
_ = @import("cases/bugs/656.zig");
_ = @import("cases/bugs/828.zig");
_ = @import("cases/bugs/920.zig");
_ = @import("cases/bugs/1111.zig");
_ = @import("cases/byval_arg_var.zig");
_ = @import("cases/cast.zig");
_ = @import("cases/const_slice_child.zig");
12 changes: 12 additions & 0 deletions test/cases/bugs/1111.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const Foo = extern enum {
Bar = -1,
};

test "issue 1111 fixed" {
const v = Foo.Bar;

switch(v) {
Foo.Bar => return,
else => return,
}
}