patch-2.1.116 linux/drivers/net/tlan.h
Next file: linux/drivers/scsi/BusLogic.c
Previous file: linux/drivers/net/tlan.c
Back to the patch index
Back to the overall index
- Lines: 34
- Date:
Sun Aug 9 10:42:41 1998
- Orig file:
v2.1.115/linux/drivers/net/tlan.h
- Orig date:
Tue Jul 21 00:15:31 1998
diff -u --recursive --new-file v2.1.115/linux/drivers/net/tlan.h linux/drivers/net/tlan.h
@@ -496,6 +496,24 @@
#define TLan_GetBit( bit, port ) ((int) (inb_p(port) & bit))
#define TLan_SetBit( bit, port ) outb_p(inb_p(port) | bit, port)
+#ifdef I_LIKE_A_FAST_HASH_FUNCTION
+/* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
+/* the code below is about seven times as fast as the original code */
+inline u32 TLan_HashFunc( u8 *a )
+{
+ u8 hash;
+
+ hash = (a[0]^a[3]); /* & 077 */
+ hash ^= ((a[0]^a[3])>>6); /* & 003 */
+ hash ^= ((a[1]^a[4])<<2); /* & 074 */
+ hash ^= ((a[1]^a[4])>>4); /* & 017 */
+ hash ^= ((a[2]^a[5])<<4); /* & 060 */
+ hash ^= ((a[2]^a[5])>>2); /* & 077 */
+
+ return (hash & 077);
+}
+
+#else /* original code */
inline u32 xor( u32 a, u32 b )
{
@@ -519,7 +537,5 @@
}
-
-
-
+#endif /* I_LIKE_A_FAST_HASH_FUNCTION */
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov