docs: Updated README.md
This commit is contained in:
22
walker.odin
22
walker.odin
@@ -1,5 +1,6 @@
|
||||
package findr
|
||||
|
||||
import "core:bytes"
|
||||
import "core:fmt"
|
||||
import "core:os"
|
||||
import "core:strings"
|
||||
@@ -180,14 +181,21 @@ collect_worker :: proc(t: ^thread.Thread) {
|
||||
batch, ok := chan.recv(data.ch)
|
||||
if !ok do break
|
||||
start := 0
|
||||
for i in 0 ..< len(batch) {
|
||||
if batch[i] == '\n' {
|
||||
if i > start {
|
||||
s, _ := strings.clone(string(batch[start:i]))
|
||||
append(data.results, s)
|
||||
}
|
||||
start = i + 1
|
||||
for {
|
||||
remaining: []u8
|
||||
#no_bounds_check {remaining = batch[start:]}
|
||||
|
||||
idx := bytes.index_byte(remaining, '\n')
|
||||
if idx < 0 do break
|
||||
|
||||
i := start + idx
|
||||
if i > start {
|
||||
segment: []u8
|
||||
#no_bounds_check {segment = batch[start:i]}
|
||||
s, _ := strings.clone(string(segment))
|
||||
append(data.results, s)
|
||||
}
|
||||
start = i + 1
|
||||
}
|
||||
delete(batch)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user