- removed defs.go (moved declarations into arith.go where they belong)
R=r
DELTA=40 (16 added, 20 deleted, 4 changed)
OCL=33464
CL=33464
TARG=big
GOFILES=\
- defs.go\
arith.go\
big.go\
nat.go\
import "unsafe"
+type Word uintptr
+
+const (
+ _S = uintptr(unsafe.Sizeof(Word)); // TODO(gri) should Sizeof return a uintptr?
+ _W = _S*8;
+ _B = 1<<_W;
+ _M = _B-1;
+ _W2 = _W/2;
+ _B2 = 1<<_W2;
+ _M2 = _B2-1;
+)
+
// ----------------------------------------------------------------------------
// Elementary operations on words
+++ /dev/null
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package big
-
-import "unsafe"
-
-type Word uintptr
-
-const (
- _S = uintptr(unsafe.Sizeof(Word)); // TODO(gri) should Sizeof return a uintptr?
- _W = _S*8;
- _B = 1<<_W;
- _M = _B-1;
- _W2 = _W/2;
- _B2 = 1<<_W2;
- _M2 = _B2-1;
-)
func makeN(z []Word, m int, clear bool) []Word {
if len(z) > m {
z = z[0 : m]; // reuse z - has at least one extra word for a carry, if any
- for i := range z {
- z[i] = 0;
+ if clear {
+ for i := range z {
+ z[i] = 0;
+ }
}
+ return z;
}
+
c := 4; // minimum capacity
if m > c {
c = m;