aboutsummaryrefslogtreecommitdiff
path: root/src/math/big/float.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2015-01-23 21:40:35 -0800
committerRobert Griesemer <gri@golang.org>2015-01-24 05:42:47 +0000
commit3acb9fd98e41014b3958cd11ba599385c4eab9cc (patch)
tree8b8c88101a29b93e6c6ab78e7db398224a3ec9f9 /src/math/big/float.go
parentbd275b238179cdaca2c01a0bf1ac60a16fbf5a98 (diff)
downloadgo-3acb9fd98e41014b3958cd11ba599385c4eab9cc.tar.xz
math/big: disable some tests on 32bit platforms (fix build)
TBR: adonovan Change-Id: I59757b5b46a2c533fc5f888423c99d550d3c7648 Reviewed-on: https://go-review.googlesource.com/3264 Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/math/big/float.go')
-rw-r--r--src/math/big/float.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/math/big/float.go b/src/math/big/float.go
index bb0aa1cefc..ed3fadbe06 100644
--- a/src/math/big/float.go
+++ b/src/math/big/float.go
@@ -357,12 +357,18 @@ func nlz(x Word) uint {
return _W - uint(bitLen(x))
}
-// TODO(gri) this assumes a Word is 64 bits
func nlz64(x uint64) uint {
- if _W != 64 {
- panic("size mismatch")
+ // TODO(gri) this can be done more nicely
+ if _W == 32 {
+ if x>>32 == 0 {
+ return 32 + nlz(Word(x))
+ }
+ return nlz(Word(x >> 32))
+ }
+ if _W == 64 {
+ return nlz(Word(x))
}
- return nlz(Word(x))
+ panic("unreachable")
}
// SetUint64 sets z to x and returns z.