}
freq = freq[:256] // eliminate bounds check for freq[c] below
- for i := range freq {
- freq[i] = 0
- }
+ clear(freq)
for _, c := range text {
freq[c]++
}
// sais_32 requires that the caller arrange to clear dst,
// because in general the caller may know dst is
// freshly-allocated and already cleared. But this one is not.
- for i := range dst {
- dst[i] = 0
- }
+ clear(dst)
sais_32(text, maxID, dst, tmp)
}
}
func sais_8_64(text []byte, textMax int, sa, tmp []int64) {
- if len(sa) != len(text) || len(tmp) < int(textMax) {
+ if len(sa) != len(text) || len(tmp) < textMax {
panic("suffixarray: misuse of sais_8_64")
}
}
func sais_32(text []int32, textMax int, sa, tmp []int32) {
- if len(sa) != len(text) || len(tmp) < int(textMax) {
+ if len(sa) != len(text) || len(tmp) < textMax {
panic("suffixarray: misuse of sais_32")
}
}
func sais_64(text []int64, textMax int, sa, tmp []int64) {
- if len(sa) != len(text) || len(tmp) < int(textMax) {
+ if len(sa) != len(text) || len(tmp) < textMax {
panic("suffixarray: misuse of sais_64")
}
}
freq = freq[:256] // eliminate bounds check for freq[c] below
- for i := range freq {
- freq[i] = 0
- }
+ clear(freq)
for _, c := range text {
freq[c]++
}
freq = bucket
}
- for i := range freq {
- freq[i] = 0
- }
+ clear(freq)
for _, c := range text {
freq[c]++
}
freq = bucket
}
- for i := range freq {
- freq[i] = 0
- }
+ clear(freq)
for _, c := range text {
freq[c]++
}
// sais_64 requires that the caller arrange to clear dst,
// because in general the caller may know dst is
// freshly-allocated and already cleared. But this one is not.
- for i := range dst {
- dst[i] = 0
- }
+ clear(dst)
sais_64(text, maxID, dst, tmp)
}