source: trunk/align.h @ 1

Last change on this file since 1 was 1, checked in by moo, 9 years ago

initial import to online

File size: 425 bytes
Line 
1#ifndef __ALIGN_H
2#define __ALIGN_H
3typedef union align_union {
4    double d;
5    void *v;
6    int (*func)(int);
7    long l;
8} align_union;
9
10#if (defined (__GNUC__) && __GNUC__ >= 2)
11#define XCACHE_PLATFORM_ALIGNMENT (__alignof__ (align_union))
12#else
13#define XCACHE_PLATFORM_ALIGNMENT (sizeof(align_union))
14#endif
15
16#define ALIGN(n) ((((size_t)(n)-1) & ~(XCACHE_PLATFORM_ALIGNMENT-1)) + XCACHE_PLATFORM_ALIGNMENT)
17
18#endif /* __ALIGN_H */
Note: See TracBrowser for help on using the repository browser.