aboutsummaryrefslogtreecommitdiffstats
path: root/gb.h
diff options
context:
space:
mode:
authorGravatar gingerBill 2016-04-26 20:04:42 +0100
committerGravatar gingerBill 2016-04-26 20:04:42 +0100
commit7db25d82b8848cbef66a801471a08f58af22dd86 (patch)
treea6c68508218909f079937a915ea70eef3c47159b /gb.h
parentFont Loading and caching (diff)
Basic Font Rendering - No Spaces yet
Diffstat (limited to 'gb.h')
-rw-r--r--gb.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/gb.h b/gb.h
index d22c437..b5057f6 100644
--- a/gb.h
+++ b/gb.h
@@ -2135,7 +2135,7 @@ GB_ALLOCATOR_PROC(gb_pool_allocator_proc)
}
-void
+gb_inline void
gb_qsort(void *base, isize count, isize size, gbCompareProc compare_proc)
{
qsort(base, count, size, compare_proc);
@@ -2143,16 +2143,15 @@ gb_qsort(void *base, isize count, isize size, gbCompareProc compare_proc)
-isize
+gb_inline isize
gb_binary_search(void const *base, isize count, isize size, void const *key, gbCompareProc compare_proc)
{
- isize start = 0, end = count;
- isize result;
+ isize start = 0;
+ isize end = count;
while (start < end) {
isize mid = start + (end-start)/2;
-
- result = compare_proc(key, cast(u8 *)base + mid*size);
+ isize result = compare_proc(key, cast(u8 *)base + mid*size);
if (result < 0)
end = mid;
else if (result > 0)
@@ -2161,7 +2160,7 @@ gb_binary_search(void const *base, isize count, isize size, void const *key, gbC
return mid;
}
- return 0; // TODO(bill): Should this be -1?
+ return -1;
}