aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/big.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-10 23:00:06 +0800
committerobscuren <geffobscura@gmail.com>2014-10-10 23:00:06 +0800
commite02c0fa8088943bc995d290e58a7226f4a0ece91 (patch)
tree1bc2ac212b46d3892dd2720304efb2ab97e43528 /ethutil/big.go
parent9b494c68698cbcaa4d8d6e0f2b964d29db815da5 (diff)
downloadgo-tangerine-e02c0fa8088943bc995d290e58a7226f4a0ece91.tar
go-tangerine-e02c0fa8088943bc995d290e58a7226f4a0ece91.tar.gz
go-tangerine-e02c0fa8088943bc995d290e58a7226f4a0ece91.tar.bz2
go-tangerine-e02c0fa8088943bc995d290e58a7226f4a0ece91.tar.lz
go-tangerine-e02c0fa8088943bc995d290e58a7226f4a0ece91.tar.xz
go-tangerine-e02c0fa8088943bc995d290e58a7226f4a0ece91.tar.zst
go-tangerine-e02c0fa8088943bc995d290e58a7226f4a0ece91.zip
Added generic big to 256 method. Implemented new iterator
Diffstat (limited to 'ethutil/big.go')
-rw-r--r--ethutil/big.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/ethutil/big.go b/ethutil/big.go
index d8f54ad10..e23d8f659 100644
--- a/ethutil/big.go
+++ b/ethutil/big.go
@@ -39,12 +39,14 @@ func BigD(data []byte) *big.Int {
// "cast" the big int to a 256 big int (i.e., limit to)
var tt256 = new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 256), big.NewInt(1))
-func To256(x *big.Int) {
+func To256(x *big.Int) *big.Int {
x.And(x, tt256)
if x.Cmp(new(big.Int)) < 0 {
x.SetInt64(0)
}
+
+ return x
}
// Big to bytes