From: Stefan Beller Date: Tue, 24 Oct 2017 20:48:54 GMT Subject: Re: [PATCH 1/4] hashmap: introduce memhash_feed to access the internals of FNV-1 hash Message-ID: In-Reply-To: <06c950e8-92c6-4926-ccac-2827d480f373@web.de> >> +unsigned int memhash_feed(unsigned int hash_seed, const unsigned char next) > > Why is the second parameter const and the first one isn't? (We tend > not to bother with const for value types.) will do. >> + hash = memhash_feed(hash, c); > > I guess compilers inline a copy of the function here with -O2. My > knee-jerk reaction, however, is horror in the face of adding a function > call to the inner loop of a hash function. Do you have performance > test results, ideally also with -O0? And why not make memhash_feed() > an inline function or macro to sidestep that issue? My gut feeling was similar, but then I assumed compilers of today would be smart. As per the discussion on a later patch, we could migrate all memhash* functions to fnv32.c except for the _feed, which will be static in its header fnv32.h Thanks, Stefan