include: Provide enum flag operators for D3D12_RESOURCE_FLAGS.

This commit is contained in:
Henri Verbeet
2017-06-15 17:09:50 +02:00
parent 7bdc8c3b25
commit 7a203b0e5f
2 changed files with 19 additions and 0 deletions

View File

@@ -209,4 +209,22 @@ typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
# define max(a, b) (((a) >= (b)) ? (a) : (b))
#endif
#ifndef DEFINE_ENUM_FLAG_OPERATORS
#ifdef __cplusplus
# define DEFINE_ENUM_FLAG_OPERATORS(type) \
extern "C++" \
{ \
inline type operator &(type x, type y) { return (type)((int)x & (int)y); } \
inline type operator &=(type &x, type y) { return (type &)((int &)x &= (int)y); } \
inline type operator ~(type x) { return (type)~(int)x; } \
inline type operator |(type x, type y) { return (type)((int)x | (int)y); } \
inline type operator |=(type &x, type y) { return (type &)((int &)x |= (int)y); } \
inline type operator ^(type x, type y) { return (type)((int)x ^ (int)y); } \
inline type operator ^=(type &x, type y) { return (type &)((int &)x ^= (int)y); } \
}
#else
# define DEFINE_ENUM_FLAG_OPERATORS(type)
#endif
#endif /* DEFINE_ENUM_FLAG_OPERATORS */
#endif /* __VKD3D_WINDOWS_H */