summaryrefslogtreecommitdiff
path: root/libgo/go/math/big/natconv_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/math/big/natconv_test.go')
-rw-r--r--libgo/go/math/big/natconv_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libgo/go/math/big/natconv_test.go b/libgo/go/math/big/natconv_test.go
index bdb60e68e0a..898a39fc2c2 100644
--- a/libgo/go/math/big/natconv_test.go
+++ b/libgo/go/math/big/natconv_test.go
@@ -8,10 +8,18 @@ import (
"bytes"
"fmt"
"io"
+ "math/bits"
"strings"
"testing"
)
+// log2 computes the integer binary logarithm of x.
+// The result is the integer n for which 2^n <= x < 2^(n+1).
+// If x == 0, the result is -1.
+func log2(x Word) int {
+ return bits.Len(uint(x)) - 1
+}
+
func itoa(x nat, base int) []byte {
// special cases
switch {