From 6f2f80887b10f6a704a7394f0580e6ee39ea611d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Sep 2014 06:15:52 +1000 Subject: GHash: use bool for comparison (simplify compare) --- source/blender/imbuf/intern/cache.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/imbuf/intern/cache.c') diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c index 0c17dd21434..677c3dbe700 100644 --- a/source/blender/imbuf/intern/cache.c +++ b/source/blender/imbuf/intern/cache.c @@ -101,14 +101,14 @@ static unsigned int imb_global_tile_hash(const void *gtile_p) return ((unsigned int)(intptr_t)gtile->ibuf) * 769 + gtile->tx * 53 + gtile->ty * 97; } -static int imb_global_tile_cmp(const void *a_p, const void *b_p) +static bool imb_global_tile_cmp(const void *a_p, const void *b_p) { const ImGlobalTile *a = a_p; const ImGlobalTile *b = b_p; - if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0; - else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1; - else return 1; + return ((a->ibuf != b->ibuf) || + (a->tx != b->tx) || + (a->ty != b->ty)); } static unsigned int imb_thread_tile_hash(const void *ttile_p) @@ -118,14 +118,14 @@ static unsigned int imb_thread_tile_hash(const void *ttile_p) return ((unsigned int)(intptr_t)ttile->ibuf) * 769 + ttile->tx * 53 + ttile->ty * 97; } -static int imb_thread_tile_cmp(const void *a_p, const void *b_p) +static bool imb_thread_tile_cmp(const void *a_p, const void *b_p) { const ImThreadTile *a = a_p; const ImThreadTile *b = b_p; - if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0; - else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1; - else return 1; + return ((a->ibuf != b->ibuf) || + (a->tx != b->tx) || + (a->ty != b->ty)); } /******************************** Load/Unload ********************************/ -- cgit v1.2.3