diff options
author | Tianon Gravi <admwiggin@gmail.com> | 2015-05-02 10:02:54 -0600 |
---|---|---|
committer | Tianon Gravi <admwiggin@gmail.com> | 2015-05-02 10:02:54 -0600 |
commit | 839657a730bd3c82d1b7932f996dd87448eb7d38 (patch) | |
tree | d46006c2df507ba8cfd57a47169d326349b5c749 /src/math | |
parent | 90ad8a7e5881be7834909c649f994b6b5244c965 (diff) | |
download | golang-839657a730bd3c82d1b7932f996dd87448eb7d38.tar.gz |
Imported Upstream version 1.4.2upstream/1.4.2upstream-sid
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/big/int.go | 2 | ||||
-rw-r--r-- | src/math/big/int_test.go | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/math/big/int.go b/src/math/big/int.go index d22e39e7c..ade5c2fc8 100644 --- a/src/math/big/int.go +++ b/src/math/big/int.go @@ -887,7 +887,7 @@ func (z *Int) AndNot(x, y *Int) *Int { } // x &^ (-y) == x &^ ^(y-1) == x & (y-1) - y1 := nat(nil).add(y.abs, natOne) + y1 := nat(nil).sub(y.abs, natOne) z.abs = z.abs.and(x.abs, y1) z.neg = false return z diff --git a/src/math/big/int_test.go b/src/math/big/int_test.go index 6070cf325..2d762dbc8 100644 --- a/src/math/big/int_test.go +++ b/src/math/big/int_test.go @@ -1201,6 +1201,7 @@ var bitwiseTests = []struct { {"-0x01", "-0x01", "-0x01", "-0x01", "0x00", "0x00"}, {"0x07", "0x08", "0x00", "0x0f", "0x0f", "0x07"}, {"0x05", "0x0f", "0x05", "0x0f", "0x0a", "0x00"}, + {"0xff", "-0x0a", "0xf6", "-0x01", "-0xf7", "0x09"}, {"0x013ff6", "0x9a4e", "0x1a46", "0x01bffe", "0x01a5b8", "0x0125b0"}, {"-0x013ff6", "0x9a4e", "0x800a", "-0x0125b2", "-0x01a5bc", "-0x01c000"}, {"-0x013ff6", "-0x9a4e", "-0x01bffe", "-0x1a46", "0x01a5b8", "0x8008"}, |