]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_properties.c
Reduce collisions in the mlt_properties hash function.
[mlt] / src / framework / mlt_properties.c
index c28af8fc514c2043f574b993b9945683cee39b84..2a37ab4d9f84613752bb5288874114d781dc5aa6 100644 (file)
@@ -328,11 +328,10 @@ int mlt_properties_preset( mlt_properties self, const char *name )
 
 static inline int generate_hash( const char *name )
 {
-       int hash = 0;
-       int i = 1;
+       unsigned int hash = 5381;
        while ( *name )
-               hash = ( hash + ( i ++ * ( *name ++ & 31 ) ) ) % 199;
-       return hash;
+               hash = hash * 33 + (unsigned int) ( *name ++ );
+       return hash % 199;
 }
 
 /** Copy a serializable property to a properties list that is mirroring this one.