diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-02 18:52:56 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-02 18:52:56 +0800 |
commit | 64f35ba8d1f31d6821a0a1bf946c71396a996f30 (patch) | |
tree | 375a081536c7c0b329a3b0c2e812ff05f81dd64c /ethutil | |
parent | 616066a598933df7ef126186eb9c647094f665ca (diff) | |
parent | 99481a245adc2c4814ab6b38d94d63114f7bbb15 (diff) | |
download | dexon-64f35ba8d1f31d6821a0a1bf946c71396a996f30.tar.gz dexon-64f35ba8d1f31d6821a0a1bf946c71396a996f30.tar.zst dexon-64f35ba8d1f31d6821a0a1bf946c71396a996f30.zip |
merge errors fixed
Diffstat (limited to 'ethutil')
-rw-r--r-- | ethutil/big.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ethutil/big.go b/ethutil/big.go index 07d1386e1..2ff1c72d8 100644 --- a/ethutil/big.go +++ b/ethutil/big.go @@ -62,6 +62,16 @@ func S256(x *big.Int) *big.Int { } } +func FirstBitSet(v *big.Int) int { + for i := 0; i < v.BitLen(); i++ { + if v.Bit(i) > 0 { + return i + } + } + + return v.BitLen() +} + // Big to bytes // // Returns the bytes of a big integer with the size specified by **base** |