windows-nt/Source/XPSP1/NT/base/win32/fusion/inc/enumbitoperations.h

15 lines
914 B
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
#pragma once
/*-----------------------------------------------------------------------------
This macro generates various bit operations (and, or, etc.) for an enum type.
Copied from \\jayk1\g\vs\src\vsee\lib\TransactionalFileSystem
-----------------------------------------------------------------------------*/
#define ENUM_BIT_OPERATIONS(e) \
inline e operator|(e x, e y) { return static_cast<e>(static_cast<INT>(x) | static_cast<INT>(y)); } \
inline e operator&(e x, e y) { return static_cast<e>(static_cast<INT>(x) & static_cast<INT>(y)); } \
inline void operator&=(e& x, INT y) { x = static_cast<e>(static_cast<INT>(x) & y); } \
inline void operator&=(e& x, e y) { x &= static_cast<INT>(y); } \
inline void operator|=(e& x, INT y) { x = static_cast<e>(static_cast<INT>(x) | y); } \
inline void operator|=(e& x, e y) { x |= static_cast<INT>(y); } \
/* maybe more in the future */