Browse code

- attempt to unroll one of the hash loops

Andrei Pelinescu-Onciul authored on 06/06/2007 21:56:27
Showing 1 changed files
... ...
@@ -44,8 +44,16 @@
44 44
 			(v)=(*(p)<<24)+((p)[1]<<16)+((p)[2]<<8)+(p)[3]; \
45 45
 			(h)+=(v)^((v)>>3); \
46 46
 		} \
47
-		(v)=0; \
48
-		for (;(p)<(end); (p)++){ (v)<<=8; (v)+=*(p);} \
47
+		switch((end)-(p)){\
48
+			case 3: \
49
+				(v)=(*(p)<<16)+((p)[1]<<8)+(p)[2]; break; \
50
+			case 2: \
51
+				(v)=(*(p)<<8)+p[1]; break; \
52
+			case 1: \
53
+				(v)=*p; break; \
54
+			default: \
55
+				(v)=0; break; \
56
+		} \
49 57
 		(h)+=(v)^((v)>>3); \
50 58
 	}while(0)
51 59