From: Andrew Cox Date: Tue, 23 Dec 2014 19:35:16 +0000 (+0000) Subject: Replaced shift and add sequence with single multiply in hash function X-Git-Tag: dali_1.0.24~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43c28815b34ba666d007c346c11753ed485496d0;p=platform%2Fcore%2Fuifw%2Fdali-core.git Replaced shift and add sequence with single multiply in hash function 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 --- diff --git a/dali/internal/common/dali-hash.cpp b/dali/internal/common/dali-hash.cpp index f154b14..4101414 100644 --- a/dali/internal/common/dali-hash.cpp +++ b/dali/internal/common/dali-hash.cpp @@ -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