API Reference Manual  1.45.0
api/abi-default/align.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2015-2018 Linaro Limited
3  */
4 
11 #ifndef ODP_ABI_ALIGN_H_
12 #define ODP_ABI_ALIGN_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <odp/api/abi/cpu.h>
19 
24 #ifdef __GNUC__
25 
26 #define ODP_ALIGNED(x) __attribute__((__aligned__(x)))
27 
28 #define ODP_PACKED __attribute__((__packed__))
29 
30 #define ODP_OFFSETOF(type, member) __builtin_offsetof(type, member)
31 
32 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
33 
34 #else
35 #error Non-gcc compatible compiler
36 #endif
37 
38 /* ODP_CACHE_LINE_SIZE is defined in odp/api/abi/cpu.h */
39 
40 #define ODP_PAGE_SIZE 4096
41 
42 #define ODP_ALIGNED_CACHE ODP_ALIGNED(ODP_CACHE_LINE_SIZE)
43 
44 #define ODP_ALIGNED_PAGE ODP_ALIGNED(ODP_PAGE_SIZE)
45 
46 #define ODP_CACHE_LINE_ROUNDUP(x) \
47 ((ODP_CACHE_LINE_SIZE) * (((x) + (ODP_CACHE_LINE_SIZE) - 1) / (ODP_CACHE_LINE_SIZE)))
48 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif