From: Øyvind Kolås Date: Sat, 31 Dec 2016 18:15:29 +0000 (+0100) Subject: hash-table: simplify integer hashing X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~139^2^2~282 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e5fe75a3d2d7480c83d1ece7bfaf965989b18979;p=babl.git hash-table: simplify integer hashing --- diff --git a/babl/babl-hash-table.c b/babl/babl-hash-table.c index d507cb2..e1c2e56 100644 --- a/babl/babl-hash-table.c +++ b/babl/babl-hash-table.c @@ -58,15 +58,11 @@ babl_hash_by_int (BablHashTable *htab, int id) { int hash = 0; - int i; - - for (i = 0; i < sizeof (int); i++) - { - hash += id & 0xFF; - hash += (hash << 10); - hash ^= (hash >> 6); - id >>= 8; - } + hash += id & 0xFF; + hash += (hash << 10); + hash ^= (hash >> 6); + id >>= 8; + hash += id & 0xFF; hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15);