Skip to content

Commit

Permalink
Reduce collisions in the mlt_properties hash function.
Browse files Browse the repository at this point in the history
  • Loading branch information
sesse authored and ddennedy committed Jan 26, 2014
1 parent ebbb877 commit 1aa26da
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/framework/mlt_properties.c
Expand Up @@ -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.
Expand Down

0 comments on commit 1aa26da

Please sign in to comment.