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_utildefines.h | |
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_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 9f68795a4a2..98177876f87 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -786,24 +786,23 @@ extern bool BLI_memory_is_zero(const void *arr, size_t arr_size); extern "C++" { \ inline constexpr _enum_type operator|(_enum_type a, _enum_type b) \ { \ - return static_cast<_enum_type>(static_cast<uint64_t>(a) | static_cast<uint64_t>(b)); \ + return (_enum_type)(uint64_t(a) | uint64_t(b)); \ } \ inline constexpr _enum_type operator&(_enum_type a, _enum_type b) \ { \ - return static_cast<_enum_type>(static_cast<uint64_t>(a) & static_cast<uint64_t>(b)); \ + return (_enum_type)(uint64_t(a) & uint64_t(b)); \ } \ inline constexpr _enum_type operator~(_enum_type a) \ { \ - return static_cast<_enum_type>(~static_cast<uint64_t>(a) & \ - (2 * static_cast<uint64_t>(_max_enum_value) - 1)); \ + return (_enum_type)(~uint64_t(a) & (2 * uint64_t(_max_enum_value) - 1)); \ } \ inline _enum_type &operator|=(_enum_type &a, _enum_type b) \ { \ - return a = static_cast<_enum_type>(static_cast<uint64_t>(a) | static_cast<uint64_t>(b)); \ + return a = (_enum_type)(uint64_t(a) | uint64_t(b)); \ } \ inline _enum_type &operator&=(_enum_type &a, _enum_type b) \ { \ - return a = static_cast<_enum_type>(static_cast<uint64_t>(a) & static_cast<uint64_t>(b)); \ + return a = (_enum_type)(uint64_t(a) & uint64_t(b)); \ } \ } /* extern "C++" */ |