Change 255 to 256

This commit is contained in:
tidwall 2021-04-28 05:10:18 -07:00
parent 47a4e16c0b
commit b467c6f1cb
1 changed files with 3 additions and 3 deletions

View File

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