Revision: 559
          http://sourceforge.net/p/vde/svn/559
Author:   rd235
Date:     2013-05-26 14:35:13 +0000 (Sun, 26 May 2013)
Log Message:
-----------
new hash function

Modified Paths:
--------------
    branches/rd235/vde-2/src/vde_switch/hash.c
    trunk/vde-2/src/vde_switch/hash.c

Modified: branches/rd235/vde-2/src/vde_switch/hash.c
===================================================================
--- branches/rd235/vde-2/src/vde_switch/hash.c  2013-03-20 10:26:31 UTC (rev 
558)
+++ branches/rd235/vde-2/src/vde_switch/hash.c  2013-05-26 14:35:13 UTC (rev 
559)
@@ -54,10 +54,11 @@
 
 static int calc_hash(uint64_t src)
 {
-       register int x = src * 0x030507090b0d1113LL;
-       x = (x ^ x >> 12 ^ x >> 8 ^ x >> 4) & hash_mask;
-       /*printf("HASH %02x:%02x:%02x:%02x:%02x:%02x V%d -> %d\n", src[0], 
src[1], src[2], src[3], src[4], src[5],(src[6]>>8)+src[7],x);*/
-       return x; 
+       src ^= src >> 33;
+       src *= 0xff51afd7ed558ccd;
+       src ^= src >> 33;
+       src *= 0xc4ceb9fe1a85ec53;
+       return src & hash_mask;
 }
 
 #if BYTE_ORDER == LITTLE_ENDIAN

Modified: trunk/vde-2/src/vde_switch/hash.c
===================================================================
--- trunk/vde-2/src/vde_switch/hash.c   2013-03-20 10:26:31 UTC (rev 558)
+++ trunk/vde-2/src/vde_switch/hash.c   2013-05-26 14:35:13 UTC (rev 559)
@@ -53,16 +53,17 @@
 
 static int calc_hash(u_int64_t src)
 {
-       register int x = src * 0x030507090b0d1113LL;
-       x = (x ^ x >> 12 ^ x >> 8 ^ x >> 4) & hash_mask;
-       /*printf("HASH %02x:%02x:%02x:%02x:%02x:%02x V%d -> %d\n", src[0], 
src[1], src[2], src[3], src[4], src[5],(src[6]>>8)+src[7],x);*/
-       return x; 
+       src ^= src >> 33;
+       src *= 0xff51afd7ed558ccd;
+       src ^= src >> 33;
+       src *= 0xc4ceb9fe1a85ec53;
+       return src & hash_mask;
 }
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define EMAC2MAC6(X) \
        (u_int)((X)&0xff), (u_int)(((X)>>8)&0xff), (u_int)(((X)>>16)&0xff), \
-  (u_int)(((X)>>24)&0xff), (u_int)(((X)>>32)&0xff), (u_int)(((X)>>40)&0xff)
+(u_int)(((X)>>24)&0xff), (u_int)(((X)>>32)&0xff), (u_int)(((X)>>40)&0xff)
 #elif BYTE_ORDER == BIG_ENDIAN
 #define EMAC2MAC6(X) \
        (u_int)(((X)>>24)&0xff), (u_int)(((X)>>16)&0xff), 
(u_int)(((X)>>8)&0xff), \

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
vde-users mailing list
vde-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vde-users

Reply via email to