From df5432ba285560e807afdf607643a7fadbf3727a Mon Sep 17 00:00:00 2001 From: James Morris Date: Fri, 2 May 2003 20:01:33 -0700 Subject: [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. --- include/linux/jhash.h | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'include/linux') 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 */ -- cgit v1.2.3