diff options
| author | James Morris <jmorris@intercode.com.au> | 2003-05-02 20:01:33 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2003-05-02 20:01:33 -0700 |
| commit | df5432ba285560e807afdf607643a7fadbf3727a (patch) | |
| tree | 0e58b860726594f06e4557ee465e4db3d67b54b1 /include/linux | |
| parent | 43ee006165c42532fc141a501fa2fc4a2b6a614a (diff) | |
[NET]: Cosmetic cleanups of jhash code.
- Consistent naming (i.e. jhash_xxx)
- Reduces the 2&1 word variants to call jhash_3words()
- Replaces __inline__ with inline.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/jhash.h | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/include/linux/jhash.h b/include/linux/jhash.h index ef973bb2a6c1..83f6af2ebcaa 100644 --- a/include/linux/jhash.h +++ b/include/linux/jhash.h @@ -41,7 +41,7 @@ * of bytes. No alignment or length assumptions are made about * the input key. */ -static __inline__ u32 jenkins_hash(void *key, u32 length, u32 initval) +static inline u32 jhash(void *key, u32 length, u32 initval) { u32 a, b, c, len; u8 *k = key; @@ -84,7 +84,7 @@ static __inline__ u32 jenkins_hash(void *key, u32 length, u32 initval) /* A special optimized version that handles 1 or more of u32s. * The length parameter here is the number of u32s in the key. */ -static __inline__ u32 hash2(u32 *k, u32 length, u32 initval) +static inline u32 jhash2(u32 *k, u32 length, u32 initval) { u32 a, b, c, len; @@ -119,8 +119,7 @@ static __inline__ u32 hash2(u32 *k, u32 length, u32 initval) * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally * done at the end is not done here. */ -static __inline__ u32 jenkins_hash_3words(u32 a, u32 b, u32 c, - u32 initval) +static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) { a += JHASH_GOLDEN_RATIO; b += JHASH_GOLDEN_RATIO; @@ -131,31 +130,14 @@ static __inline__ u32 jenkins_hash_3words(u32 a, u32 b, u32 c, return c; } -static __inline__ u32 jenkins_hash_2words(u32 a, u32 b, u32 initval) +static inline u32 jhash_2words(u32 a, u32 b, u32 initval) { - u32 c = 0; - - a += JHASH_GOLDEN_RATIO; - b += JHASH_GOLDEN_RATIO; - c += initval; - - __jhash_mix(a, b, c); - - return c; + return jhash_3words(a, b, 0, initval); } -static __inline__ u32 jenkins_hash_1word(u32 a, u32 initval) +static inline u32 jhash_1word(u32 a, u32 initval) { - u32 b = 0; - u32 c = 0; - - a += JHASH_GOLDEN_RATIO; - b += JHASH_GOLDEN_RATIO; - c += initval; - - __jhash_mix(a, b, c); - - return c; + return jhash_3words(a, 0, 0, initval); } #endif /* _LINUX_JHASH_H */ |
