aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/__bsearch.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/__bsearch.h b/include/__bsearch.h
index e6b181b..d0dbf81 100644
--- a/include/__bsearch.h
+++ b/include/__bsearch.h
@@ -6,18 +6,17 @@
static TYPE mlib_lookup(rune ch) \
{ \
ptrdiff_t i, lo, hi; \
- if (ch >= lengthof(TABLE)) \
- return DEFAULT; \
lo = 0; \
hi = lengthof(TABLE) - 1; \
i = (lo + hi) / 2; \
do { \
if (ch < TABLE[i].lo) \
hi = i - 1; \
- else if (ch >= TABLE[i].hi) \
+ else if (ch > TABLE[i].hi) \
lo = i + 1; \
else \
return TABLE[i].val; \
+ i = (lo + hi) / 2; \
} while (lo <= hi); \
return DEFAULT; \
}