diff options
Diffstat (limited to 'libgo/go/math/big/int.go')
-rw-r--r-- | libgo/go/math/big/int.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/libgo/go/math/big/int.go b/libgo/go/math/big/int.go index bf2fd20..d1b5602 100644 --- a/libgo/go/math/big/int.go +++ b/libgo/go/math/big/int.go @@ -53,7 +53,7 @@ func (z *Int) SetInt64(x int64) *Int { // SetUint64 sets z to x and returns z. func (z *Int) SetUint64(x uint64) *Int { - z.abs = z.abs.setUint64(uint64(x)) + z.abs = z.abs.setUint64(x) z.neg = false return z } @@ -513,13 +513,7 @@ func (z *Int) Scan(s fmt.ScanState, ch rune) error { // Int64 returns the int64 representation of x. // If x cannot be represented in an int64, the result is undefined. func (x *Int) Int64() int64 { - if len(x.abs) == 0 { - return 0 - } - v := int64(x.abs[0]) - if _W == 32 && len(x.abs) > 1 { - v |= int64(x.abs[1]) << 32 - } + v := int64(x.Uint64()) if x.neg { v = -v } @@ -527,7 +521,7 @@ func (x *Int) Int64() int64 { } // Uint64 returns the uint64 representation of x. -// If x cannot be represented in an uint64, the result is undefined. +// If x cannot be represented in a uint64, the result is undefined. func (x *Int) Uint64() uint64 { if len(x.abs) == 0 { return 0 @@ -795,8 +789,8 @@ func (x *Int) Bit(i int) uint { } // SetBit sets z to x, with x's i'th bit set to b (0 or 1). -// That is, if bit is 1 SetBit sets z = x | (1 << i); -// if bit is 0 it sets z = x &^ (1 << i). If bit is not 0 or 1, +// That is, if b is 1 SetBit sets z = x | (1 << i); +// if b is 0 SetBit sets z = x &^ (1 << i). If b is not 0 or 1, // SetBit will panic. func (z *Int) SetBit(x *Int, i int, b uint) *Int { if i < 0 { |