1 /*
2  * BEGIN illumos section
3  *   This is an unstable interface; changes may be made
4  *   without notice.
5  * END illumos section
6  */
7 /***********************************************************************
8 *                                                                      *
9 *               This software is part of the ast package               *
10 *          Copyright (c) 1985-2025 AT&T Intellectual Property          *
11 *                         All Rights Reserved                          *
12 *       This software is licensed by AT&T Intellectual Property        *
13 *           under the terms and conditions of the license in           *
14 *          http://www.eclipse.org/org/documents/epl-v10.html           *
15 *      (with an md5 checksum of b35adb5213ca9657e911e9befb180842)      *
16 *                                                                      *
17 *              Information and Software Systems Research               *
18 *                            AT&T Research                             *
19 *                           Florham Park NJ                            *
20 *                                                                      *
21 *                 Glenn Fowler <gsf@research.att.com>                  *
22 *                  David Korn <dgk@research.att.com>                   *
23 *                   Phong Vo <kpv@research.att.com>                    *
24 *                                                                      *
25 ***********************************************************************/
26 /* : : generated from contrib/ast/src/lib/libast/features/align.c by iffe version 2012-07-17 : : */
27 #ifndef _def_align_ast
28 #define _def_align_ast	1
29 #define _sys_types	1	/* #include <sys/types.h> ok */
30 
31 #define ALIGN_CHUNK		8192
32 #define ALIGN_INTEGRAL		uintptr_t
33 #define ALIGN_INTEGER(x)	((char*)(x)-(char*)0)
34 #define ALIGN_POINTER(x)	((char*)(x))
35 #define ALIGN_ROUND(x,y)	ALIGN_POINTER(ALIGN_INTEGER((x)+(y)-1)&~((y)-1))
36 
37 #define ALIGN_BOUND		ALIGN_BOUND2
38 #define ALIGN_ALIGN(x)		ALIGN_ALIGN2(x)
39 #define ALIGN_TRUNC(x)		ALIGN_TRUNC2(x)
40 
41 #define ALIGN_BIT1		0x1
42 #define ALIGN_BOUND1		ALIGN_BOUND2
43 #define ALIGN_ALIGN1(x)		ALIGN_ALIGN2(x)
44 #define ALIGN_TRUNC1(x)		ALIGN_TRUNC2(x)
45 #ifndef __amd64
46 #define ALIGN_CLRBIT1(x)	ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffe)
47 #else /* __amd64 */
48 #define ALIGN_CLRBIT1(x)	ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffffffffffe)
49 #endif /* __amd64 */
50 #define ALIGN_SETBIT1(x)	ALIGN_POINTER(ALIGN_INTEGER(x)|0x1)
51 #define ALIGN_TSTBIT1(x)	ALIGN_POINTER(ALIGN_INTEGER(x)&0x1)
52 
53 #define ALIGN_BIT2		0x2
54 #ifndef __amd64
55 #define ALIGN_BOUND2		4
56 #define ALIGN_ALIGN2(x)		ALIGN_TRUNC2((x)+3)
57 #define ALIGN_TRUNC2(x)		ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffc)
58 #define ALIGN_CLRBIT2(x)	ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffd)
59 #else /* __amd64 */
60 #define ALIGN_BOUND2		16
61 #define ALIGN_ALIGN2(x)		ALIGN_TRUNC2((x)+15)
62 #define ALIGN_TRUNC2(x)		ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffffffffff0)
63 #define ALIGN_CLRBIT2(x)	ALIGN_POINTER(ALIGN_INTEGER(x)&0xfffffffffffffffd)
64 #endif /* __amd64 */
65 #define ALIGN_SETBIT2(x)	ALIGN_POINTER(ALIGN_INTEGER(x)|0x2)
66 #define ALIGN_TSTBIT2(x)	ALIGN_POINTER(ALIGN_INTEGER(x)&0x2)
67 
68 #endif
69