diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-06-01 13:40:30 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-06-01 13:40:30 +0000 |
commit | e0f4eafb689e75d66b34c40592024c1e698b0836 (patch) | |
tree | 9f410d5972df06328504bc803ca58cd4eb53cb9a /apps/plugins/lib/jhash.h | |
parent | cb7f0099288786b3d4a80a2e36edbd55f3fcc028 (diff) | |
download | rockbox-e0f4eafb689e75d66b34c40592024c1e698b0836.tar.gz rockbox-e0f4eafb689e75d66b34c40592024c1e698b0836.zip |
Add Bob Jenkins' lookup3 32-bit and 64-bit hashes to pluginlib.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21155 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/jhash.h')
-rw-r--r-- | apps/plugins/lib/jhash.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/plugins/lib/jhash.h b/apps/plugins/lib/jhash.h new file mode 100644 index 0000000000..97d1ac3d93 --- /dev/null +++ b/apps/plugins/lib/jhash.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Andrew Mahone | ||
11 | * | ||
12 | * jhash.c headers | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #ifndef _LIB_JHASH_H_ | ||
25 | #define _LIB_JHASH_H_ | ||
26 | #include <inttypes.h> /* defines uint32_t etc */ | ||
27 | #include <sys/types.h> | ||
28 | #include <plugin.h> | ||
29 | |||
30 | /* | ||
31 | hashw() -- hash an array of uint32_t into a 32-bit value | ||
32 | k: pointer to the key, an array of uint32_t | ||
33 | length: number of elements in the key | ||
34 | initval: an initialization value | ||
35 | returns the 32-bit hash | ||
36 | */ | ||
37 | uint32_t hashw(const uint32_t *k, size_t length, uint32_t initval); | ||
38 | |||
39 | /* | ||
40 | hashw() -- hash an array of uint32_t into two 32-bit values | ||
41 | (*pc) will be the same as the return value from hashword(). | ||
42 | k: pointer to the key, an array of uint32_t | ||
43 | length: number of elements in the key | ||
44 | pc, pb: pointers to primary and secondary initial values, also used to store | ||
45 | the hash results. | ||
46 | */ | ||
47 | void hashw2 (const uint32_t *k, size_t length, uint32_t *pc, uint32_t *pb); | ||
48 | |||
49 | /* | ||
50 | hashs() -- hash an array of bytes into a 32-bit value | ||
51 | k: pointer to the key, an array of bytes | ||
52 | length: number of elements in the key | ||
53 | initval: an initialization value | ||
54 | returns the 32-bit hash | ||
55 | */ | ||
56 | uint32_t hashs( const void *key, size_t length, uint32_t initval); | ||
57 | |||
58 | /* | ||
59 | hashs2() -- hash an array of bytes into two 32-bit values | ||
60 | k: pointer to the key, an array of bytes | ||
61 | length: number of elements in the key | ||
62 | pc, pb: pointers to primary and secondary initial values, also used to store | ||
63 | the hash results. | ||
64 | */ | ||
65 | void hashs2(const void *key, size_t length, uint32_t *pc, uint32_t *pb); | ||
66 | #endif | ||
67 | |||