mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Fix potential bug in binsearch
This commit is contained in:
parent
d3ee6f36c2
commit
b592cda3db
@ -296,9 +296,10 @@ __device__
|
|||||||
int bitwise_binsearch(const float *hay, float needle) {
|
int bitwise_binsearch(const float *hay, float needle) {
|
||||||
int lo = 0;
|
int lo = 0;
|
||||||
|
|
||||||
|
// TODO: improve efficiency on 64-bit arches
|
||||||
{{for i in range(search_rounds-1, -1, -1)}}
|
{{for i in range(search_rounds-1, -1, -1)}}
|
||||||
if (needle > hay[lo | {{1 << i}}])
|
if (needle > hay[lo + {{1 << i}}])
|
||||||
lo |= {{1 << i}};
|
lo += {{1 << i}};
|
||||||
{{endfor}}
|
{{endfor}}
|
||||||
return lo;
|
return lo;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user