util: move ARRAY_SIZE/CONTAINER_OF to non-ASM part of file
These macros have C language-isms and cannot be used from assembly code. Change-Id: I07ffc27411300339e08ae7ef9c19249903be4774 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
a34afe9b61
commit
0304cbc36d
1 changed files with 2 additions and 2 deletions
|
@ -42,12 +42,12 @@ Misc utilities usable by nanokernel, microkernel, and application code.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ASMLANGUAGE
|
||||||
|
|
||||||
#define ARRAY_SIZE(array) ((unsigned long)(sizeof(array) / sizeof((array)[0])))
|
#define ARRAY_SIZE(array) ((unsigned long)(sizeof(array) / sizeof((array)[0])))
|
||||||
#define CONTAINER_OF(ptr, type, field) \
|
#define CONTAINER_OF(ptr, type, field) \
|
||||||
((type *)(((char *)(ptr)) - offsetof(type, field)))
|
((type *)(((char *)(ptr)) - offsetof(type, field)))
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
|
||||||
|
|
||||||
/* round "x" up/down to next multiple of "align" (which must be a power of 2) */
|
/* round "x" up/down to next multiple of "align" (which must be a power of 2) */
|
||||||
#define ROUND_UP(x, align) \
|
#define ROUND_UP(x, align) \
|
||||||
(((unsigned long)(x) + ((unsigned long)align - 1)) & \
|
(((unsigned long)(x) + ((unsigned long)align - 1)) & \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue