mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:43:02 +00:00
[NDK] Fix alignment macros and add missing ones
Remove obsolete ALIGN_UP_BY macro definition
This commit is contained in:
parent
ca9fd861aa
commit
3b78272d39
2 changed files with 20 additions and 10 deletions
|
@ -73,17 +73,29 @@ Author:
|
||||||
//
|
//
|
||||||
// Alignment Macros
|
// Alignment Macros
|
||||||
//
|
//
|
||||||
#define ALIGN_DOWN(s, t) \
|
#define ALIGN_DOWN_BY(size, align) \
|
||||||
((ULONG)(s) & ~(sizeof(t) - 1))
|
((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
|
||||||
|
|
||||||
#define ALIGN_UP(s, t) \
|
#define ALIGN_UP_BY(size, align) \
|
||||||
(ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
|
(ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
|
||||||
|
|
||||||
#define ALIGN_DOWN_POINTER(p, t) \
|
#define ALIGN_DOWN_POINTER_BY(ptr, align) \
|
||||||
((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
|
((PVOID)ALIGN_DOWN_BY(ptr, align))
|
||||||
|
|
||||||
#define ALIGN_UP_POINTER(p, t) \
|
#define ALIGN_UP_POINTER_BY(ptr, align) \
|
||||||
(ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
|
((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
|
// Native API Return Value Macros
|
||||||
|
|
|
@ -56,8 +56,6 @@ enum
|
||||||
RXactSetValueKey = 2,
|
RXactSetValueKey = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ALIGN_UP_BY ROUND_UP
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue