yumapro  20.10-12
YumaPro SDK
bobhash.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 - 2012, Andy Bierman, All Rights Reserved.
3  * Copyright (c) 2012 - 2021, YumaWorks, Inc., All Rights Reserved.
4  *
5  * Unless required by applicable law or agreed to in writing,
6  * software distributed under the License is distributed on an
7  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the
9  * specific language governing permissions and limitations
10  * under the License.
11  */
12 #ifndef _H_bobhash
13 #define _H_bobhash
14 
15 /* FILE: bobhash.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
27 /*********************************************************************
28 * *
29 * C H A N G E H I S T O R Y *
30 * *
31 *********************************************************************
32 
33 date init comment
34 ----------------------------------------------------------------------
35 17-oct-05 abb Begun -- copied from PSAMP Sampling Techniques
36 
37 */
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /********************************************************************
44 * *
45 * C O N S T A N T S *
46 * *
47 *********************************************************************/
48 
49 #define hashsize(n) ((uint32)1<<(n))
50 
51 #define hashmask(n) (hashsize(n)-1)
52 
53 // remove register keyword; deprecated so not being used
54 // define to register to add back
55 #define REGISTER
56 
57 /********************************************************************
58 * *
59 * F U N C T I O N S *
60 * *
61 *********************************************************************/
62 
114 extern uint32
115  bobhash (REGISTER const uint8 *k, /* the key */
116  REGISTER uint32 length, /* the length of the key */
117  REGISTER uint32 initval); /* an arbitrary value */
118 
121 #ifdef __cplusplus
122 } /* end extern 'C' */
123 #endif
124 
125 #endif /* _H_bobhash */
bobhash
uint32 bobhash(REGISTER const uint8 *k, REGISTER uint32 length, REGISTER uint32 initval)
Calculate a 32-bit BOB hash value.
Definition: bobhash.c:177
bobhash.h
BOB hash function.