big: Several fixes to bitwise functions

Fixed:
* SetString calls in bitwise tests
* Aliasing problem with self bitwise test
* One test case that was just flat out wrong
* Slice panics in nat.or and nat.xor
* Aliasing problems in Int.And, Int.AndNot, Int.Or, Int.Xor

Fixes #1007.

R=gri
CC=golang-dev
https://golang.org/cl/1895049
diff --git a/src/pkg/big/int_test.go b/src/pkg/big/int_test.go
index 66379ca..117852a 100755
--- a/src/pkg/big/int_test.go
+++ b/src/pkg/big/int_test.go
@@ -938,7 +938,7 @@
 	bitwiseTest{"0x00", "0x01", "0x00", "0x01", "0x01", "0x00"},
 	bitwiseTest{"0x01", "0x00", "0x00", "0x01", "0x01", "0x01"},
 	bitwiseTest{"-0x01", "0x00", "0x00", "-0x01", "-0x01", "-0x01"},
-	bitwiseTest{"-0xAF", "-0x50", "0x00", "-0xFF", "-0x01", "-0x01"},
+	bitwiseTest{"-0xaf", "-0x50", "-0xf0", "-0x0f", "0xe1", "0x41"},
 	bitwiseTest{"0x00", "-0x01", "0x00", "-0x01", "-0x01", "0x00"},
 	bitwiseTest{"0x01", "0x01", "0x01", "0x01", "0x00", "0x00"},
 	bitwiseTest{"-0x01", "-0x01", "-0x01", "-0x01", "0x00", "0x00"},
@@ -978,24 +978,24 @@
 
 func testBitFun(t *testing.T, msg string, f bitFun, x, y *Int, exp string) {
 	expected := new(Int)
-	expected.SetString(exp, 16)
+	expected.SetString(exp, 0)
 
 	out := f(new(Int), x, y)
 	if out.Cmp(expected) != 0 {
-		println("Test failed")
 		t.Errorf("%s: got %s want %s", msg, out, expected)
 	}
 }
 
 
 func testBitFunSelf(t *testing.T, msg string, f bitFun, x, y *Int, exp string) {
+	self := new(Int)
+	self.Set(x)
 	expected := new(Int)
-	expected.SetString(exp, 16)
+	expected.SetString(exp, 0)
 
-	x = f(x, x, y)
-	if x.Cmp(expected) != 0 {
-		println("Test failed")
-		t.Errorf("%s: got %s want %s", msg, x, expected)
+	self = f(self, self, y)
+	if self.Cmp(expected) != 0 {
+		t.Errorf("%s: got %s want %s", msg, self, expected)
 	}
 }
 
@@ -1004,8 +1004,8 @@
 	x := new(Int)
 	y := new(Int)
 	for _, test := range bitwiseTests {
-		x.SetString(test.x, 16)
-		y.SetString(test.y, 16)
+		x.SetString(test.x, 0)
+		y.SetString(test.y, 0)
 
 		testBitFun(t, "and", (*Int).And, x, y, test.and)
 		testBitFunSelf(t, "and", (*Int).And, x, y, test.and)