aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ks_index.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ks_index.c b/ks_index.c
index c093a0a..f506a32 100644
--- a/ks_index.c
+++ b/ks_index.c
@@ -56,8 +56,8 @@ static int ks_find(const hal_ks_index_t * const ksi,
int hi = ksi->used;
for (;;) {
- int m = (lo + hi) >> 1;
- if (m == lo) {
+ int m = (lo + hi) / 2;
+ if (hi == 0 || m == lo) {
*where = hi;
return 0;
}