From 4762661711b2e36514149faa1250b0e52c9fa3d2 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Thu, 11 Sep 2008 11:24:13 +0000 Subject: [PATCH] Use bit manipulation instead of memory access, improve eet speed with big edje file. SVN revision: 35946 --- legacy/eet/src/lib/eet_utils.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/legacy/eet/src/lib/eet_utils.c b/legacy/eet/src/lib/eet_utils.c index 1785076a71..10eb5407ff 100644 --- a/legacy/eet/src/lib/eet_utils.c +++ b/legacy/eet/src/lib/eet_utils.c @@ -13,21 +13,9 @@ _eet_hash_gen(const char *key, int hash_size) { int hash_num = 0; int value, i; + int mask; unsigned char *ptr; - const int masks[9] = - { - 0x00, - 0x01, - 0x03, - 0x07, - 0x0f, - 0x1f, - 0x3f, - 0x7f, - 0xff - }; - /* no string - index 0 */ if (!key) return 0; @@ -38,7 +26,8 @@ _eet_hash_gen(const char *key, int hash_size) hash_num ^= (value | (value << 8)) >> (i & 0x7); /* mask it */ - hash_num &= masks[hash_size]; + mask = (1 << hash_size) - 1; + hash_num &= mask; /* return it */ return hash_num; }