Commit 65837359 authored by zhiqiangxu's avatar zhiqiangxu Committed by GitHub

simplify bigMSB (#9998)

parent 2d03c726
......@@ -146,9 +146,5 @@ func bigMSB(x *big.Int) Depth {
if x.Cmp(big.NewInt(0)) == 0 {
return 0
}
out := Depth(0)
for ; x.Cmp(big.NewInt(0)) != 0; out++ {
x = new(big.Int).Rsh(x, 1)
}
return out - 1
return Depth(x.BitLen() - 1)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment