Doxygen Source Code Documentation
hasher.c File Reference
#include <stdio.h>
Go to the source code of this file.
Defines | |
#define | UINT unsigned int |
#define | SLOTS 8191 |
Functions | |
UINT | hasher (char *str) |
int | main (int argc, char *argv[]) |
Define Documentation
|
Definition at line 5 of file hasher.c. Referenced by hasher(). |
|
|
Function Documentation
|
Definition at line 12 of file hasher.c. Referenced by main().
00013 { 00014 UINT hh , jj,kk ; char *cpt ; 00015 00016 if( str == NULL ) return 0 ; 00017 if( str[0] == '\0' ) return 1 ; 00018 00019 hh = 0 ; 00020 for( cpt=str ; *cpt != '\0' ; cpt++ ){ 00021 jj = (65537*(UINT)(*cpt)) ; cpt++ ; 00022 kk = 17389*(UINT)(*cpt) ; 00023 hh = 13*hh + (jj << 8) + kk ; 00024 if( *cpt == '\0' ) break ; 00025 } 00026 00027 hh = ((hh & 0xaaaaaaaa) >> 1) /* swap bits */ 00028 | ((hh & 0x55555555) << 1) ; 00029 00030 return (hh % SLOTS) ; 00031 } |
|
\** File : SUMA.c
Input paramters :
Definition at line 33 of file hasher.c. References argc, hasher(), and UINT.
|