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_color.hh | |
parent | 28b10224346a9a2e55267f98357991a841eeda5b (diff) |
Cleanup: use C++ style casts in various places
Diffstat (limited to 'source/blender/blenlib/BLI_color.hh')
-rw-r--r-- | source/blender/blenlib/BLI_color.hh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh index c0d2f43645d..e57a5109a66 100644 --- a/source/blender/blenlib/BLI_color.hh +++ b/source/blender/blenlib/BLI_color.hh @@ -63,10 +63,10 @@ struct Color4f { uint64_t hash() const { - uint64_t x1 = *(uint32_t *)&r; - uint64_t x2 = *(uint32_t *)&g; - uint64_t x3 = *(uint32_t *)&b; - uint64_t x4 = *(uint32_t *)&a; + uint64_t x1 = *reinterpret_cast<const uint32_t *>(&r); + uint64_t x2 = *reinterpret_cast<const uint32_t *>(&g); + uint64_t x3 = *reinterpret_cast<const uint32_t *>(&b); + uint64_t x4 = *reinterpret_cast<const uint32_t *>(&a); return (x1 * 1283591) ^ (x2 * 850177) ^ (x3 * 735391) ^ (x4 * 442319); } }; @@ -120,8 +120,8 @@ struct Color4b { uint64_t hash() const { - return ((uint64_t)r * 1283591) ^ ((uint64_t)g * 850177) ^ ((uint64_t)b * 735391) ^ - ((uint64_t)a * 442319); + return static_cast<uint64_t>(r * 1283591) ^ static_cast<uint64_t>(g * 850177) ^ + static_cast<uint64_t>(b * 735391) ^ static_cast<uint64_t>(a * 442319); } }; |