Imported Upstream version 1.1.11
[platform/upstream/cdrkit.git] / include / align.h.in
1 /*
2  * This file has been generated automatically
3  * by CMake commands. Do not edit.
4  *
5  * Original contents from @(#)align_test.c      1.19 03/11/25 Copyright 1995 J. Schilling
6  *
7  */
8
9 #ifndef _UTYPES_H
10 #include <utypes.h>
11 #endif
12
13 #define ALIGN_SHORT @SIZE_SHORT@
14 #define ALIGN_INT @SIZE_INT@
15 #define ALIGN_LONG @SIZE_LONG@
16 #define ALIGN_LLONG @SIZE_LLONG@
17 #define ALIGN_FLOAT @SIZE_FLOAT@
18 #define ALIGN_DOUBLE @SIZE_DOUBLE@
19 #define ALIGN_PTR @SIZE_PTR@
20
21 #define SIZE_SHORT @SIZE_SHORT@
22 #define SIZE_INT @SIZE_INT@
23 #define SIZE_LONG @SIZE_LONG@
24 #define SIZE_LLONG @SIZE_LLONG@
25 #define SIZE_FLOAT @SIZE_FLOAT@
26 #define SIZE_DOUBLE @SIZE_DOUBLE@
27 #define SIZE_PTR @SIZE_PTR@
28
29
30 #define ALIGN_SMASK @SHORTLESS@
31 #define ALIGN_IMASK @INTLESS@
32 #define ALIGN_LMASK @LONGLESS@
33 #define ALIGN_LLMASK @LLONGLESS@
34 #define ALIGN_FMASK @FLOATLESS@
35 #define ALIGN_DMASK @DOUBLELESS@
36 #define ALIGN_PMASK @PTRLESS@
37
38
39 /*
40  * There used to be a cast to an int but we get a warning from GCC.
41  * This warning message from GCC is wrong.
42  * Believe me that this macro would even be usable if I would cast to short.
43  * In order to avoid this warning, we are now using UIntptr_t
44  */
45 #define xaligned(a, s)          ((((UIntptr_t)(a)) & (s)) == 0 )
46 #define x2aligned(a, b, s)      (((((UIntptr_t)(a)) | ((UIntptr_t)(b))) & (s)) == 0 )
47
48 #define saligned(a)             xaligned(a, ALIGN_SMASK)
49 #define s2aligned(a, b)         x2aligned(a, b, ALIGN_SMASK)
50
51 #define ialigned(a)             xaligned(a, ALIGN_IMASK)
52 #define i2aligned(a, b)         x2aligned(a, b, ALIGN_IMASK)
53
54 #define laligned(a)             xaligned(a, ALIGN_LMASK)
55 #define l2aligned(a, b)         x2aligned(a, b, ALIGN_LMASK)
56
57 #define llaligned(a)            xaligned(a, ALIGN_LLMASK)
58 #define ll2aligned(a, b)        x2aligned(a, b, ALIGN_LLMASK)
59
60 #define faligned(a)             xaligned(a, ALIGN_FMASK)
61 #define f2aligned(a, b)         x2aligned(a, b, ALIGN_FMASK)
62
63 #define daligned(a)             xaligned(a, ALIGN_DMASK)
64 #define d2aligned(a, b)         x2aligned(a, b, ALIGN_DMASK)
65
66 #define paligned(a)             xaligned(a, ALIGN_PMASK)
67 #define p2aligned(a, b)         x2aligned(a, b, ALIGN_PMASK)
68
69
70 /*
71  * There used to be a cast to an int but we get a warning from GCC.
72  * This warning message from GCC is wrong.
73  * Believe me that this macro would even be usable if I would cast to short.
74  * In order to avoid this warning, we are now using UIntptr_t
75  */
76 #define xalign(x, a, m)         ( ((char *)(x)) + ( (a) - 1 - ((((UIntptr_t)(x))-1)&(m))) )
77
78 #define salign(x)               xalign((x), ALIGN_SHORT, ALIGN_SMASK)
79 #define ialign(x)               xalign((x), ALIGN_INT, ALIGN_IMASK)
80 #define lalign(x)               xalign((x), ALIGN_LONG, ALIGN_LMASK)
81 #define llalign(x)              xalign((x), ALIGN_LLONG, ALIGN_LLMASK)
82 #define falign(x)               xalign((x), ALIGN_FLOAT, ALIGN_FMASK)
83 #define dalign(x)               xalign((x), ALIGN_DOUBLE, ALIGN_DMASK)
84 #define palign(x)               xalign((x), ALIGN_PTR, ALIGN_PMASK)