- Add DDK alignment macros and move/rename the ones in the NDK for user-mode only...
[reactos.git] / reactos / include / ndk / umtypes.h
index 005812c..b479bc5 100644 (file)
@@ -20,6 +20,7 @@ Author:
 #define _NTDEF_
 #define _NTDEF_H
 #undef WIN32_NO_STATUS
+#define NTOS_MODE_USER
 
 //
 // Dependencies
@@ -59,6 +60,21 @@ Author:
 #endif
 #endif
 
+//
+// Alignment Macros
+//
+#define ALIGN_DOWN(s, t) \
+    ((ULONG)(s) & ~(sizeof(t) - 1))
+
+#define ALIGN_UP(s, t) \
+    (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
+
+#define ALIGN_DOWN_POINTER(p, t) \
+    ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
+
+#define ALIGN_UP_POINTER(p, t) \
+    (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
+
 //
 // Native API Return Value Macros
 //