From b592cda3dbc028540486904f9d542ef0b346e233 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Fri, 9 Dec 2011 14:14:00 -0500 Subject: [PATCH] Fix potential bug in binsearch --- cuburn/code/interp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cuburn/code/interp.py b/cuburn/code/interp.py index a4c5519..0cbae08 100644 --- a/cuburn/code/interp.py +++ b/cuburn/code/interp.py @@ -296,9 +296,10 @@ __device__ int bitwise_binsearch(const float *hay, float needle) { int lo = 0; + // TODO: improve efficiency on 64-bit arches {{for i in range(search_rounds-1, -1, -1)}} - if (needle > hay[lo | {{1 << i}}]) - lo |= {{1 << i}}; + if (needle > hay[lo + {{1 << i}}]) + lo += {{1 << i}}; {{endfor}} return lo; }