summaryrefslogtreecommitdiffstats
path: root/zix/sorted_array.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-10-18 17:24:02 +0200
committerDavid Robillard <d@drobilla.net>2019-10-18 20:15:53 +0200
commit2a3693d151b38fa912d4e1f83cc090194ebe215c (patch)
treef12df6d8fde9d1be9abd0f7fc816e8459bd204ad /zix/sorted_array.c
parent813d202a306f1e7f582ad00da78f5ff5a94a4680 (diff)
downloadzix-2a3693d151b38fa912d4e1f83cc090194ebe215c.tar.gz
zix-2a3693d151b38fa912d4e1f83cc090194ebe215c.tar.bz2
zix-2a3693d151b38fa912d4e1f83cc090194ebe215c.zip
Fix SortedArray
Diffstat (limited to 'zix/sorted_array.c')
-rw-r--r--zix/sorted_array.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/zix/sorted_array.c b/zix/sorted_array.c
index b2096b2..0f08e89 100644
--- a/zix/sorted_array.c
+++ b/zix/sorted_array.c
@@ -148,12 +148,12 @@ zix_sorted_array_find(const ZixSortedArray* a,
const void* e,
ZixSortedArrayIter* ai)
{
- uintptr_t lower = 0;
- uintptr_t upper = (uintptr_t)a->num_elems - 1;
+ intptr_t lower = 0;
+ intptr_t upper = a->num_elems - 1;
while (upper >= lower) {
- const uintptr_t i = lower + ((upper - lower) / 2);
- void* const elem_i = zix_sorted_array_index_unchecked(a, i);
- const int cmp = a->cmp(elem_i, e, a->cmp_data);
+ const intptr_t i = lower + ((upper - lower) / 2);
+ void* const elem_i = zix_sorted_array_index_unchecked(a, i);
+ const int cmp = a->cmp(elem_i, e, a->cmp_data);
if (cmp == 0) {
*ai = elem_i;