Slide 15
Slide 15 text
if, lenで確認してから
func f3(s []int, index int) {
if index >= 0 && index < len(s) {
_ = s[index] // Bounds Check Elimination!!
_ = s[index:len(s)] // Bounds Check Elimination!!
}
}
func f4(s []int) {
if len(s) > 2 {
_, _, _ = s[0], s[1], s[2]//Bounds Check Elimination!!
}
}