diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-25 00:15:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-25 00:16:37 +0400 |
commit | 6f2f80887b10f6a704a7394f0580e6ee39ea611d (patch) | |
tree | f27b5f9f2d009e2784fc058c22581a95b9d834da /source/blender/imbuf | |
parent | faaf0c719f3310759bf5f2c9be76f6788a923364 (diff) |
GHash: use bool for comparison (simplify compare)
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/cache.c | 16 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 15 | ||||
-rw-r--r-- | source/blender/imbuf/intern/moviecache.c | 2 |
3 files changed, 12 insertions, 21 deletions
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 ********************************/ diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 06dd128137b..5dd6b366a93 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -252,22 +252,13 @@ static unsigned int colormanage_hashhash(const void *key_v) return rval; } -static int colormanage_hashcmp(const void *av, const void *bv) +static bool colormanage_hashcmp(const void *av, const void *bv) { const ColormanageCacheKey *a = (ColormanageCacheKey *) av; const ColormanageCacheKey *b = (ColormanageCacheKey *) bv; - if (a->view < b->view) - return -1; - else if (a->view > b->view) - return 1; - - if (a->display < b->display) - return -1; - else if (a->display > b->display) - return 1; - - return 0; + return ((a->view != b->view) || + (a->display != b->display)); } static struct MovieCache *colormanage_moviecache_ensure(ImBuf *ibuf) diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c index ea75673e5f0..1641bd3089b 100644 --- a/source/blender/imbuf/intern/moviecache.c +++ b/source/blender/imbuf/intern/moviecache.c @@ -104,7 +104,7 @@ static unsigned int moviecache_hashhash(const void *keyv) return key->cache_owner->hashfp(key->userkey); } -static int moviecache_hashcmp(const void *av, const void *bv) +static bool moviecache_hashcmp(const void *av, const void *bv) { const MovieCacheKey *a = (MovieCacheKey *)av; const MovieCacheKey *b = (MovieCacheKey *)bv; |