turn on VALGRIND macro for portability

This commit is contained in:
Russ Rew 2010-08-03 18:59:54 +00:00
parent 817502e6e1
commit b07789adfd

View File

@ -2,11 +2,16 @@
-------------------------------------------------------------------------------
lookup3.c, by Bob Jenkins, May 2006, Public Domain.
Original: http://burtleburtle.net/bob/c/lookup3.c
Superficially modified by Russ Rew for adaption in netCDF.
Modified by Russ Rew for adaption in netCDF.
- Make use of Paul Hsieh's pstdint.h, if stdint.h not available.
- Declare unused functions static to keep global namespace clean.
- Provide function hash_fast() that uses either hashlittle() or
hashbig(), depending on endianness.
- Because portability is more important than speed for netCDF use,
we define VALGRIND to skip "#ifndef VALGRIND" code, so reads of
strings don't access extra bytes after end of string. This may
slow it down enough to justify a simpler hash, but blame me, not
original author!
These are functions for producing 32-bit hashes for hash table lookup.
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
@ -54,6 +59,8 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
# include <endian.h> /* attempt to define endianness */
#endif
#define VALGRIND /* added by Russ Rew, for portability over speed */
#ifndef WORDS_BIGENDIAN /* from config.h */
#define HASH_LITTLE_ENDIAN 1
#define HASH_BIG_ENDIAN 0