1*b4dd7d09SAndy Fiddaman/* : : generated from contrib/ast/src/lib/libast/features/align.c by iffe version 2012-07-17 : : */ 2*b4dd7d09SAndy Fiddaman#ifndef _def_align_ast 3*b4dd7d09SAndy Fiddaman#define _def_align_ast 1 4*b4dd7d09SAndy Fiddaman#define _sys_types 1 /* #include <sys/types.h> ok */ 5*b4dd7d09SAndy Fiddaman 6*b4dd7d09SAndy Fiddaman#define ALIGN_CHUNK 8192 7*b4dd7d09SAndy Fiddaman#define ALIGN_INTEGRAL uintptr_t 8*b4dd7d09SAndy Fiddaman#define ALIGN_INTEGER(x) ((char*)(x)-(char*)0) 9*b4dd7d09SAndy Fiddaman#define ALIGN_POINTER(x) ((char*)(x)) 10*b4dd7d09SAndy Fiddaman#define ALIGN_ROUND(x,y) ALIGN_POINTER(ALIGN_INTEGER((x)+(y)-1)&~((y)-1)) 11*b4dd7d09SAndy Fiddaman 12*b4dd7d09SAndy Fiddaman#define ALIGN_BOUND ALIGN_BOUND2 13*b4dd7d09SAndy Fiddaman#define ALIGN_ALIGN(x) ALIGN_ALIGN2(x) 14*b4dd7d09SAndy Fiddaman#define ALIGN_TRUNC(x) ALIGN_TRUNC2(x) 15*b4dd7d09SAndy Fiddaman 16*b4dd7d09SAndy Fiddaman#define ALIGN_BIT1 0x1 17*b4dd7d09SAndy Fiddaman#define ALIGN_BOUND1 ALIGN_BOUND2 18*b4dd7d09SAndy Fiddaman#define ALIGN_ALIGN1(x) ALIGN_ALIGN2(x) 19*b4dd7d09SAndy Fiddaman#define ALIGN_TRUNC1(x) ALIGN_TRUNC2(x) 20*b4dd7d09SAndy Fiddaman#define ALIGN_CLRBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffe) 21*b4dd7d09SAndy Fiddaman#define ALIGN_SETBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)|0x1) 22*b4dd7d09SAndy Fiddaman#define ALIGN_TSTBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x1) 23*b4dd7d09SAndy Fiddaman 24*b4dd7d09SAndy Fiddaman#define ALIGN_BIT2 0x2 25*b4dd7d09SAndy Fiddaman#define ALIGN_BOUND2 4 26*b4dd7d09SAndy Fiddaman#define ALIGN_ALIGN2(x) ALIGN_TRUNC2((x)+3) 27*b4dd7d09SAndy Fiddaman#define ALIGN_TRUNC2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffc) 28*b4dd7d09SAndy Fiddaman#define ALIGN_CLRBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffd) 29*b4dd7d09SAndy Fiddaman#define ALIGN_SETBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)|0x2) 30*b4dd7d09SAndy Fiddaman#define ALIGN_TSTBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x2) 31*b4dd7d09SAndy Fiddaman 32*b4dd7d09SAndy Fiddaman#endif 33