core/vm: optimize osakaMultComplexity

This commit is contained in:
cuiweixie 2025-11-04 23:17:42 +08:00
parent 395425902d
commit cae375f141
No known key found for this signature in database
GPG key ID: 16DF64EE15E495A3

View file

@ -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.