source: trunk/util/xc_align.h @ 982

Last change on this file since 982 was 982, checked in by moo, 2 years ago

move files to subdirs

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