From b467c6f1cb4d83f1df0072a91c38920d087fb497 Mon Sep 17 00:00:00 2001 From: tidwall Date: Wed, 28 Apr 2021 05:10:18 -0700 Subject: [PATCH] Change 255 to 256 --- internal/collection/collection.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/collection/collection.go b/internal/collection/collection.go index d8c84633..7293be5e 100644 --- a/internal/collection/collection.go +++ b/internal/collection/collection.go @@ -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() }