ssa: makeSlice both len/cap be non-nil
This commit is contained in:
15
internal/runtime/math/math.go
Normal file
15
internal/runtime/math/math.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package math
|
||||
|
||||
import "github.com/goplus/llgo/internal/runtime/goarch"
|
||||
|
||||
const MaxUintptr = ^uintptr(0)
|
||||
|
||||
// MulUintptr returns a * b and whether the multiplication overflowed.
|
||||
// On supported platforms this is an intrinsic lowered by the compiler.
|
||||
func MulUintptr(a, b uintptr) (uintptr, bool) {
|
||||
if a|b < 1<<(4*goarch.PtrSize) || a == 0 {
|
||||
return a * b, false
|
||||
}
|
||||
overflow := b > MaxUintptr/a
|
||||
return a * b, overflow
|
||||
}
|
||||
Reference in New Issue
Block a user