From 2a3693d151b38fa912d4e1f83cc090194ebe215c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 18 Oct 2019 17:24:02 +0200 Subject: Fix SortedArray --- zix/sorted_array.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'zix/sorted_array.c') 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; -- cgit v1.2.1