From 155df55b5c42d4861ccd287c9a8a51fe177c4f09 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 7 May 2012 20:48:00 -0700 Subject: [PATCH] break hash finishing stuff out to be called only once --- xwords4/common/movestak.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xwords4/common/movestak.c b/xwords4/common/movestak.c index fa47b251f..91e11f842 100644 --- a/xwords4/common/movestak.c +++ b/xwords4/common/movestak.c @@ -92,10 +92,16 @@ augmentHash( XP_U32 hash, const XP_U8* ptr, XP_U16 len ) hash += (hash << 10); 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 >> 11); hash += (hash << 15); - // XP_LOGF( "%s: hashed %d bytes -> %X", __func__, len, (unsigned int)hash ); return hash; } @@ -151,7 +157,7 @@ stack_getHash( StackCtxt* stack ) XP_ASSERT( 0 != hash ); // LOG_RETURNF( "%.8X", (unsigned int)hash ); #endif - return hash; + return finshHash( hash ); } #endif