diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eet/src/lib/eet_utils.c | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/eet/src/lib/eet_utils.c')
-rw-r--r-- | libraries/eet/src/lib/eet_utils.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libraries/eet/src/lib/eet_utils.c b/libraries/eet/src/lib/eet_utils.c new file mode 100644 index 0000000..8e591a2 --- /dev/null +++ b/libraries/eet/src/lib/eet_utils.c | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif /* ifdef HAVE_CONFIG_H */ | ||
4 | |||
5 | #include <stdio.h> | ||
6 | #include <math.h> | ||
7 | |||
8 | #include "Eet.h" | ||
9 | #include "Eet_private.h" | ||
10 | |||
11 | int | ||
12 | _eet_hash_gen(const char *key, | ||
13 | int hash_size) | ||
14 | { | ||
15 | int hash_num = 0; | ||
16 | int value, i; | ||
17 | int mask; | ||
18 | unsigned char *ptr; | ||
19 | |||
20 | /* no string - index 0 */ | ||
21 | if (!key) | ||
22 | return 0; | ||
23 | |||
24 | /* calc hash num */ | ||
25 | for (i = 0, ptr = (unsigned char *)key, value = (int)(*ptr); | ||
26 | value; | ||
27 | ptr++, i++, value = (int)(*ptr)) | ||
28 | hash_num ^= (value | (value << 8)) >> (i & 0x7); | ||
29 | |||
30 | /* mask it */ | ||
31 | mask = (1 << hash_size) - 1; | ||
32 | hash_num &= mask; | ||
33 | /* return it */ | ||
34 | return hash_num; | ||
35 | } /* _eet_hash_gen */ | ||
36 | |||