jody_hash.h 820 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* Jody Bruchon's fast hashing function (headers)
  2. * See jody_hash.c for license information */
  3. #ifndef JODY_HASH_H
  4. #define JODY_HASH_H
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. /* Required for uint64_t */
  9. #include <stdint.h>
  10. /* Width of a jody_hash. Changing this will also require
  11. * changing the width of tail masks to match. */
  12. #ifndef JODY_HASH_WIDTH
  13. #define JODY_HASH_WIDTH 64
  14. #endif
  15. #if JODY_HASH_WIDTH == 64
  16. typedef uint64_t hash_t;
  17. #endif
  18. #if JODY_HASH_WIDTH == 32
  19. typedef uint32_t hash_t;
  20. #endif
  21. #if JODY_HASH_WIDTH == 16
  22. typedef uint16_t hash_t;
  23. #endif
  24. /* Version increments when algorithm changes incompatibly */
  25. #define JODY_HASH_VERSION 5
  26. extern hash_t jody_block_hash(const hash_t * restrict data,
  27. const hash_t start_hash, const size_t count);
  28. #ifdef __cplusplus
  29. }
  30. #endif
  31. #endif /* JODY_HASH_H */