BsUtil.h 1.0 KB

123456789101112131415161718192021222324252627282930
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include <BsEnumClassHash.h>
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup General
  8. * @{
  9. */
  10. /** Generates a new hash for the provided type using the default standard hasher and combines it with a previous hash. */
  11. template <class T>
  12. inline void hash_combine(std::size_t& seed, const T& v)
  13. {
  14. using HashType = typename std::conditional<std::is_enum<T>::value, EnumClassHash, std::hash<T>>::type;
  15. HashType hasher;
  16. // std::hash<T> hasher;
  17. seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
  18. }
  19. /** Generates an MD5 hash string for the provided source string. */
  20. String BS_UTILITY_EXPORT md5(const WString& source);
  21. /** Generates an MD5 hash string for the provided source string. */
  22. String BS_UTILITY_EXPORT md5(const String& source);
  23. /** @} */
  24. }