Update gtimer_timer.go

bugfix: avoid overflow
This commit is contained in:
None
2020-11-05 22:33:33 +08:00
committed by GitHub
parent 176dcdc7cc
commit fef20d10a2

View File

@ -233,7 +233,7 @@ func (t *Timer) binSearchIndex(n int64) (index int, result int) {
mid := 0
cmp := -2
for min <= max {
mid = int((min + max) / 2)
mid = min + int((max-min)/2)
switch {
case t.wheels[mid].intervalMs == n:
cmp = 0