use static and reinterpret cast instead of c cast

This commit is contained in:
Sascha Kühl 2025-05-08 22:04:14 +02:00
parent c9cf4b8997
commit 7d47ef0b82
1 changed files with 7 additions and 7 deletions

View File

@ -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<cascade_type>(~static_cast<int>(a)); }
inline cascade_type operator| (cascade_type a, cascade_type b) { return static_cast<cascade_type>(static_cast<int>(a) | static_cast<int>(b)); }
inline cascade_type operator& (cascade_type a, cascade_type b) { return static_cast<cascade_type>(static_cast<int>(a) & static_cast<int>(b)); }
inline cascade_type operator^ (cascade_type a, cascade_type b) { return static_cast<cascade_type>(static_cast<int>(a) ^ static_cast<int>(b)); }
inline cascade_type& operator|= (cascade_type& a, cascade_type b) { return reinterpret_cast<cascade_type &>(reinterpret_cast<int &>(a) |= static_cast<int>(b)); }
inline cascade_type& operator&= (cascade_type& a, cascade_type b) { return reinterpret_cast<cascade_type &>(reinterpret_cast<int &>(a) &= static_cast<int>(b)); }
inline cascade_type& operator^= (cascade_type& a, cascade_type b) { return reinterpret_cast<cascade_type &>(reinterpret_cast<int &>(a) ^= static_cast<int>(b)); }
}
#endif //OOS_CASCADE_TYPE_HPP