Change 255 to 256

This commit is contained in:
tidwall 2021-04-28 05:10:18 -07:00
parent 5cf6c4e9f4
commit 0b8254e7c2
1 changed files with 3 additions and 3 deletions

View File

@ -13,8 +13,8 @@ import (
"github.com/tidwall/tile38/internal/deadline"
)
// yieldStep forces the iterator to yield goroutine every 255 steps.
const yieldStep = 255
// yieldStep forces the iterator to yield goroutine every 256 steps.
const yieldStep = 256
// Cursor allows for quickly paging through Scan, Within, Intersects, and Nearby
type Cursor interface {
@ -763,7 +763,7 @@ func (c *Collection) Nearby(
}
func nextStep(step uint64, cursor Cursor, deadline *deadline.Deadline) {
if step&yieldStep == yieldStep {
if step&(yieldStep-1) == (yieldStep - 1) {
runtime.Gosched()
deadline.Check()
}