diff options
author | Jacques Lucke <jacques@blender.org> | 2020-08-07 19:24:59 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-08-07 19:42:21 +0300 |
commit | c50e5fcc344d00b03eb4a3141b5b45944c3570fd (patch) | |
tree | f683ae1a1f38551d160a5be2ee86561d51faca26 /source/blender/blenlib/BLI_hash.hh | |
parent | 28b10224346a9a2e55267f98357991a841eeda5b (diff) |
Cleanup: use C++ style casts in various places
Diffstat (limited to 'source/blender/blenlib/BLI_hash.hh')
-rw-r--r-- | source/blender/blenlib/BLI_hash.hh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_hash.hh b/source/blender/blenlib/BLI_hash.hh index ad3224e037a..8301dbb8e3a 100644 --- a/source/blender/blenlib/BLI_hash.hh +++ b/source/blender/blenlib/BLI_hash.hh @@ -110,7 +110,7 @@ template<typename T> struct DefaultHash<const T> { template<> struct DefaultHash<TYPE> { \ uint64_t operator()(TYPE value) const \ { \ - return (uint64_t)value; \ + return static_cast<uint64_t>(value); \ } \ } @@ -135,14 +135,14 @@ TRIVIAL_DEFAULT_INT_HASH(uint64_t); template<> struct DefaultHash<float> { uint64_t operator()(float value) const { - return *(uint32_t *)&value; + return *reinterpret_cast<uint32_t *>(&value); } }; template<> struct DefaultHash<bool> { uint64_t operator()(bool value) const { - return (uint64_t)(value != false) * 1298191; + return static_cast<uint64_t>((value != false) * 1298191); } }; @@ -186,8 +186,8 @@ template<> struct DefaultHash<StringRefNull> { template<typename T> struct DefaultHash<T *> { uint64_t operator()(const T *value) const { - uintptr_t ptr = (uintptr_t)value; - uint64_t hash = (uint64_t)(ptr >> 4); + uintptr_t ptr = reinterpret_cast<uintptr_t>(value); + uint64_t hash = static_cast<uint64_t>(ptr >> 4); return hash; } }; |