break hash finishing stuff out to be called only once

This commit is contained in:
Eric House 2012-05-07 20:48:00 -07:00
parent e82faedc63
commit 155df55b5c

View file

@ -92,10 +92,16 @@ augmentHash( XP_U32 hash, const XP_U8* ptr, XP_U16 len )
hash += (hash << 10); hash += (hash << 10);
hash ^= (hash >> 6); hash ^= (hash >> 6);
} }
// XP_LOGF( "%s: hashed %d bytes -> %X", __func__, len, (unsigned int)hash );
return hash;
}
static XP_U32
finshHash( XP_U32 hash )
{
hash += (hash << 3); hash += (hash << 3);
hash ^= (hash >> 11); hash ^= (hash >> 11);
hash += (hash << 15); hash += (hash << 15);
// XP_LOGF( "%s: hashed %d bytes -> %X", __func__, len, (unsigned int)hash );
return hash; return hash;
} }
@ -151,7 +157,7 @@ stack_getHash( StackCtxt* stack )
XP_ASSERT( 0 != hash ); XP_ASSERT( 0 != hash );
// LOG_RETURNF( "%.8X", (unsigned int)hash ); // LOG_RETURNF( "%.8X", (unsigned int)hash );
#endif #endif
return hash; return finshHash( hash );
} }
#endif #endif