aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp/api/align.h
blob: c238b80af6ea2ea6631eb25d71ed163f45e2061a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Copyright (c) 2013, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:	BSD-3-Clause
 */

/**
 * @file
 *
 * ODP alignments
 */

#ifndef ODP_PLAT_ALIGN_H_
#define ODP_PLAT_ALIGN_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/cpu_arch.h>

/** @ingroup odp_compiler_optim
 *  @{
 */

#ifdef __GNUC__

#define ODP_ALIGNED(x) __attribute__((__aligned__(x)))

#define ODP_PACKED __attribute__((__packed__))

#define ODP_OFFSETOF(type, member) __builtin_offsetof(type, member)

#define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)

#else
#error Non-gcc compatible compiler
#endif

#define ODP_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE

#define ODP_PAGE_SIZE       4096

#define ODP_ALIGNED_CACHE   ODP_ALIGNED(ODP_CACHE_LINE_SIZE)

#define ODP_ALIGNED_PAGE    ODP_ALIGNED(ODP_PAGE_SIZE)

/**
 * @}
 */

#include <odp/api/spec/align.h>

#ifdef __cplusplus
}
#endif

#endif