aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/big.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethutil/big.go')
-rw-r--r--ethutil/big.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/ethutil/big.go b/ethutil/big.go
index 979078bef..1a3902fa3 100644
--- a/ethutil/big.go
+++ b/ethutil/big.go
@@ -35,3 +35,18 @@ func BigD(data []byte) *big.Int {
return n
}
+
+func BigToBytes(num *big.Int, base int) []byte {
+ ret := make([]byte, base/8)
+
+ return append(ret[:len(ret)-len(num.Bytes())], num.Bytes()...)
+}
+
+// Functions like the build in "copy" function
+// but works on big integers
+func BigCopy(src *big.Int) (ret *big.Int) {
+ ret = new(big.Int)
+ ret.Add(ret, src)
+
+ return
+}