diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2008-09-11 11:24:13 +0000 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2008-09-11 11:24:13 +0000 |
commit | 4762661711b2e36514149faa1250b0e52c9fa3d2 (patch) | |
tree | 2e01a0c152f50d1b64b649c96fb7f5c7cd851989 /legacy/eet/src/lib/eet_utils.c | |
parent | 581104105397a5826a152e41f35bd23370bf864e (diff) |
Use bit manipulation instead of memory access, improve eet speed with big edje file.
SVN revision: 35946
Diffstat (limited to 'legacy/eet/src/lib/eet_utils.c')
-rw-r--r-- | legacy/eet/src/lib/eet_utils.c | 17 |
1 files 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) | |||
13 | { | 13 | { |
14 | int hash_num = 0; | 14 | int hash_num = 0; |
15 | int value, i; | 15 | int value, i; |
16 | int mask; | ||
16 | unsigned char *ptr; | 17 | unsigned char *ptr; |
17 | 18 | ||
18 | const int masks[9] = | ||
19 | { | ||
20 | 0x00, | ||
21 | 0x01, | ||
22 | 0x03, | ||
23 | 0x07, | ||
24 | 0x0f, | ||
25 | 0x1f, | ||
26 | 0x3f, | ||
27 | 0x7f, | ||
28 | 0xff | ||
29 | }; | ||
30 | |||
31 | /* no string - index 0 */ | 19 | /* no string - index 0 */ |
32 | if (!key) return 0; | 20 | if (!key) return 0; |
33 | 21 | ||
@@ -38,7 +26,8 @@ _eet_hash_gen(const char *key, int hash_size) | |||
38 | hash_num ^= (value | (value << 8)) >> (i & 0x7); | 26 | hash_num ^= (value | (value << 8)) >> (i & 0x7); |
39 | 27 | ||
40 | /* mask it */ | 28 | /* mask it */ |
41 | hash_num &= masks[hash_size]; | 29 | mask = (1 << hash_size) - 1; |
30 | hash_num &= mask; | ||
42 | /* return it */ | 31 | /* return it */ |
43 | return hash_num; | 32 | return hash_num; |
44 | } | 33 | } |