Hash.h 990 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Util/StdTypes.h>
  7. namespace anki {
  8. /// @addtogroup util_other
  9. /// @{
  10. /// Computes a hash of a buffer. This function implements the MurmurHash2 algorithm by Austin Appleby.
  11. /// @param[in] buffer The buffer to hash.
  12. /// @param bufferSize The size of the buffer.
  13. /// @param seed A unique seed.
  14. /// @return The hash.
  15. ANKI_USE_RESULT U64 computeHash(const void* buffer, PtrSize bufferSize, U64 seed = 123);
  16. /// Computes a hash of a buffer. This function implements the MurmurHash2 algorithm by Austin Appleby.
  17. /// @param[in] buffer The buffer to hash.
  18. /// @param bufferSize The size of the buffer.
  19. /// @param prevHash The hash to append to.
  20. /// @return The new hash.
  21. ANKI_USE_RESULT U64 appendHash(const void* buffer, PtrSize bufferSize, U64 prevHash);
  22. /// @}
  23. } // end namespace anki