From 7d47ef0b82305a0a1acdaf9c8b20ce1ef0fb97e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20K=C3=BChl?= Date: Thu, 8 May 2025 22:04:14 +0200 Subject: [PATCH] use static and reinterpret cast instead of c cast --- include/matador/utils/cascade_type.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/matador/utils/cascade_type.hpp b/include/matador/utils/cascade_type.hpp index a102499..47bd64a 100644 --- a/include/matador/utils/cascade_type.hpp +++ b/include/matador/utils/cascade_type.hpp @@ -15,13 +15,13 @@ enum class cascade_type ALL = REMOVE | UPDATE | INSERT /**< Cascade type all */ }; -inline cascade_type operator~ (cascade_type a) { return (cascade_type)~(int)a; } -inline cascade_type operator| (cascade_type a, cascade_type b) { return (cascade_type)((int)a | (int)b); } -inline cascade_type operator& (cascade_type a, cascade_type b) { return (cascade_type)((int)a & (int)b); } -inline cascade_type operator^ (cascade_type a, cascade_type b) { return (cascade_type)((int)a ^ (int)b); } -inline cascade_type& operator|= (cascade_type& a, cascade_type b) { return (cascade_type&)((int&)a |= (int)b); } -inline cascade_type& operator&= (cascade_type& a, cascade_type b) { return (cascade_type&)((int&)a &= (int)b); } -inline cascade_type& operator^= (cascade_type& a, cascade_type b) { return (cascade_type&)((int&)a ^= (int)b); } +inline cascade_type operator~ (cascade_type a) { return static_cast(~static_cast(a)); } +inline cascade_type operator| (cascade_type a, cascade_type b) { return static_cast(static_cast(a) | static_cast(b)); } +inline cascade_type operator& (cascade_type a, cascade_type b) { return static_cast(static_cast(a) & static_cast(b)); } +inline cascade_type operator^ (cascade_type a, cascade_type b) { return static_cast(static_cast(a) ^ static_cast(b)); } +inline cascade_type& operator|= (cascade_type& a, cascade_type b) { return reinterpret_cast(reinterpret_cast(a) |= static_cast(b)); } +inline cascade_type& operator&= (cascade_type& a, cascade_type b) { return reinterpret_cast(reinterpret_cast(a) &= static_cast(b)); } +inline cascade_type& operator^= (cascade_type& a, cascade_type b) { return reinterpret_cast(reinterpret_cast(a) ^= static_cast(b)); } } #endif //OOS_CASCADE_TYPE_HPP