Author: jgardou
Date: Tue Aug 2 06:10:15 2011
New Revision: 53024
URL:
http://svn.reactos.org/svn/reactos?rev=53024&view=rev
Log:
[PSDK/WINNT.H]
- add DEFINE_ENUM_FLAG_OPERATORS macro
Modified:
trunk/reactos/include/psdk/winnt.h
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=5…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Tue Aug 2 06:10:15 2011
@@ -313,6 +313,22 @@
#define ERROR_SEVERITY_INFORMATIONAL 0x40000000
#define ERROR_SEVERITY_WARNING 0x80000000
#define ERROR_SEVERITY_ERROR 0xC0000000
+
+#ifdef __cplusplus
+#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
+extern "C++" { \
+ inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return
ENUMTYPE(((int)a)|((int)b)); } \
+ inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE
&)(((int &)a) |= ((int)b)); } \
+ inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return
ENUMTYPE(((int)a)&((int)b)); } \
+ inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE
&)(((int &)a) &= ((int)b)); } \
+ inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
+ inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return
ENUMTYPE(((int)a)^((int)b)); } \
+ inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE
&)(((int &)a) ^= ((int)b)); } \
+}
+#else
+#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
+#endif
+
/* also in ddk/ntifs.h */
#define COMPRESSION_FORMAT_NONE (0x0000)
#define COMPRESSION_FORMAT_DEFAULT (0x0001)