Hash.h 990 B

12345678910111213141516171819202122232425262728293031
  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. {
  9. /// @addtogroup util_other
  10. /// @{
  11. /// Computes a hash of a buffer. This function implements the MurmurHash2 algorithm by Austin Appleby.
  12. /// @param[in] buffer The buffer to hash.
  13. /// @param bufferSize The size of the buffer.
  14. /// @param seed A unique seed.
  15. /// @return The hash.
  16. ANKI_USE_RESULT U64 computeHash(const void* buffer, PtrSize bufferSize, U64 seed = 123);
  17. /// Computes a hash of a buffer. This function implements the MurmurHash2 algorithm by Austin Appleby.
  18. /// @param[in] buffer The buffer to hash.
  19. /// @param bufferSize The size of the buffer.
  20. /// @param prevHash The hash to append to.
  21. /// @return The new hash.
  22. ANKI_USE_RESULT U64 appendHash(const void* buffer, PtrSize bufferSize, U64 prevHash);
  23. /// @}
  24. } // end namespace anki