mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 20:13:40 +00:00
compiler: support 64-bit numbers in bounds check
This commit is contained in:
@@ -29,6 +29,14 @@ func lookupBoundsCheck(length lenType, index int) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for bounds in *ssa.Index, *ssa.IndexAddr and *ssa.Lookup.
|
||||
// Supports 64-bit indexes.
|
||||
func lookupBoundsCheckLong(length lenType, index int64) {
|
||||
if index < 0 || index >= int64(length) {
|
||||
runtimePanic("index out of range")
|
||||
}
|
||||
}
|
||||
|
||||
// Check for bounds in *ssa.Slice.
|
||||
func sliceBoundsCheck(length lenType, low, high uint) {
|
||||
if !(0 <= low && low <= high && high <= uint(length)) {
|
||||
|
||||
Reference in New Issue
Block a user