https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3b78272d3956228bb3902…
commit 3b78272d3956228bb39026d7090c2b2bf14dbb87
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Thu Feb 15 22:14:11 2018 +0100
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sun Jul 1 14:45:21 2018 +0200
[NDK] Fix alignment macros and add missing ones
Remove obsolete ALIGN_UP_BY macro definition
---
sdk/include/ndk/umtypes.h | 28 ++++++++++++++++++++--------
sdk/lib/rtl/rxact.c | 2 --
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/sdk/include/ndk/umtypes.h b/sdk/include/ndk/umtypes.h
index e9d192a40e..3037151b6b 100644
--- a/sdk/include/ndk/umtypes.h
+++ b/sdk/include/ndk/umtypes.h
@@ -73,17 +73,29 @@ Author:
//
// Alignment Macros
//
-#define ALIGN_DOWN(s, t) \
- ((ULONG)(s) & ~(sizeof(t) - 1))
+#define ALIGN_DOWN_BY(size, align) \
+ ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
-#define ALIGN_UP(s, t) \
- (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
+#define ALIGN_UP_BY(size, align) \
+ (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
-#define ALIGN_DOWN_POINTER(p, t) \
- ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
+#define ALIGN_DOWN_POINTER_BY(ptr, align) \
+ ((PVOID)ALIGN_DOWN_BY(ptr, align))
-#define ALIGN_UP_POINTER(p, t) \
- (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
+#define ALIGN_UP_POINTER_BY(ptr, align) \
+ ((PVOID)ALIGN_UP_BY(ptr, align))
+
+#define ALIGN_DOWN(size, type) \
+ ALIGN_DOWN_BY(size, sizeof(type))
+
+#define ALIGN_UP(size, type) \
+ ALIGN_UP_BY(size, sizeof(type))
+
+#define ALIGN_DOWN_POINTER(ptr, type) \
+ ALIGN_DOWN_POINTER_BY(ptr, sizeof(type))
+
+#define ALIGN_UP_POINTER(ptr, type) \
+ ALIGN_UP_POINTER_BY(ptr, sizeof(type))
//
// Native API Return Value Macros
diff --git a/sdk/lib/rtl/rxact.c b/sdk/lib/rtl/rxact.c
index cc9f9609a6..42936872c6 100644
--- a/sdk/lib/rtl/rxact.c
+++ b/sdk/lib/rtl/rxact.c
@@ -56,8 +56,6 @@ enum
RXactSetValueKey = 2,
};
-#define ALIGN_UP_BY ROUND_UP
-
/* FUNCTIONS *****************************************************************/
static