Replaced shift and add sequence with single multiply in hash function 80/32780/3
authorAndrew Cox <andrew.cox@partner.samsung.com>
Tue, 23 Dec 2014 19:35:16 +0000 (19:35 +0000)
committerAndrew Cox <andrew.cox@partner.samsung.com>
Wed, 7 Jan 2015 10:06:08 +0000 (10:06 +0000)
Archaic optimisation to think a sequence of instructions with
pipeline-stalling dependencies beats a single imul.
Compilers can still make the substitution with a shift and add if they
want to for a particular platform.

Change-Id: I313a5f98eae665f0fabd266fee09c078547be2ec
Signed-off-by: Andrew Cox <andrew.cox@partner.samsung.com>
dali/internal/common/dali-hash.cpp

index f154b14..4101414 100644 (file)
@@ -33,7 +33,7 @@ inline void HashShader( const char* string, unsigned long& hash )
 {
   while( int c = *string++ )
   {
-    hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+    hash = hash * 33 + c;
   }
 }
 } // un-named namespace