diff options
author | Jacques Lucke <jacques@blender.org> | 2022-09-25 18:39:45 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-09-25 18:39:45 +0300 |
commit | c6e70e7bacf82b38ca7125d6821713a711489c0b (patch) | |
tree | 3679590f6254b7fbbd6623080edafe217f20c7b6 /source/blender/blenlib/BLI_hash.hh | |
parent | 0419ee871ff960f62e28a2a9fed764f66c616d71 (diff) |
Cleanup: follow C++ type cast style guide in some files
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast
This was discussed in https://devtalk.blender.org/t/rfc-style-guide-for-type-casts-in-c-code/25907.
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 25d7cd6aaf8..693d4a8a71c 100644 --- a/source/blender/blenlib/BLI_hash.hh +++ b/source/blender/blenlib/BLI_hash.hh @@ -85,7 +85,7 @@ template<typename T> struct DefaultHash { { if constexpr (std::is_enum_v<T>) { /* For enums use the value as hash directly. */ - return (uint64_t)value; + return uint64_t(value); } else { /* Try to call the `hash()` function on the value. */ @@ -119,7 +119,7 @@ template<typename T> struct DefaultHash<const T> { template<> struct DefaultHash<TYPE> { \ uint64_t operator()(TYPE value) const \ { \ - return static_cast<uint64_t>(value); \ + return uint64_t(value); \ } \ } @@ -158,7 +158,7 @@ template<> struct DefaultHash<double> { template<> struct DefaultHash<bool> { uint64_t operator()(bool value) const { - return static_cast<uint64_t>((value != false) * 1298191); + return uint64_t((value != false) * 1298191); } }; @@ -209,8 +209,8 @@ template<> struct DefaultHash<std::string_view> { template<typename T> struct DefaultHash<T *> { uint64_t operator()(const T *value) const { - uintptr_t ptr = reinterpret_cast<uintptr_t>(value); - uint64_t hash = static_cast<uint64_t>(ptr >> 4); + uintptr_t ptr = uintptr_t(value); + uint64_t hash = uint64_t(ptr >> 4); return hash; } }; |