mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
core/vm: optimize osakaMultComplexity
This commit is contained in:
parent
395425902d
commit
cae375f141
1 changed files with 2 additions and 3 deletions
|
|
@ -456,11 +456,10 @@ func osakaMultComplexity(x uint64) uint64 {
|
|||
}
|
||||
// For x > 32, return 2 * berlinMultComplexity(x)
|
||||
result := berlinMultComplexity(x)
|
||||
carry, result := bits.Mul64(result, 2)
|
||||
if carry != 0 {
|
||||
if result >= (1 << 63) { // overflow check
|
||||
return math.MaxUint64
|
||||
}
|
||||
return result
|
||||
return result << 1
|
||||
}
|
||||
|
||||
// modexpIterationCount calculates the number of iterations for the modexp precompile.
|
||||
|
|
|
|||
Loading…
Reference in a new issue