xref: /freebsd/sys/arm64/include/_align.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
1412042e2SAndrew Turner /*-
2412042e2SAndrew Turner  * Copyright (c) 1990 The Regents of the University of California.
3412042e2SAndrew Turner  * All rights reserved.
4412042e2SAndrew Turner  *
5412042e2SAndrew Turner  * This code is derived from software contributed to Berkeley by
6412042e2SAndrew Turner  * William Jolitz.
7412042e2SAndrew Turner  *
8412042e2SAndrew Turner  * Redistribution and use in source and binary forms, with or without
9412042e2SAndrew Turner  * modification, are permitted provided that the following conditions
10412042e2SAndrew Turner  * are met:
11412042e2SAndrew Turner  * 1. Redistributions of source code must retain the above copyright
12412042e2SAndrew Turner  *    notice, this list of conditions and the following disclaimer.
13412042e2SAndrew Turner  * 2. Redistributions in binary form must reproduce the above copyright
14412042e2SAndrew Turner  *    notice, this list of conditions and the following disclaimer in the
15412042e2SAndrew Turner  *    documentation and/or other materials provided with the distribution.
16412042e2SAndrew Turner  *
17412042e2SAndrew Turner  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18412042e2SAndrew Turner  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19412042e2SAndrew Turner  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20412042e2SAndrew Turner  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21412042e2SAndrew Turner  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22412042e2SAndrew Turner  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23412042e2SAndrew Turner  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24412042e2SAndrew Turner  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25412042e2SAndrew Turner  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26412042e2SAndrew Turner  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27412042e2SAndrew Turner  * SUCH DAMAGE.
28412042e2SAndrew Turner  */
29412042e2SAndrew Turner 
30*d5d97bedSMike Karels #ifdef __arm__
31*d5d97bedSMike Karels #include <arm/_align.h>
32*d5d97bedSMike Karels #else /* !__arm__ */
33*d5d97bedSMike Karels 
34412042e2SAndrew Turner #ifndef _MACHINE__ALIGN_H_
35412042e2SAndrew Turner #define	_MACHINE__ALIGN_H_
36412042e2SAndrew Turner 
37412042e2SAndrew Turner /*
38412042e2SAndrew Turner  * Round p (pointer or byte index) up to a correctly-aligned value
39412042e2SAndrew Turner  * for all data types (int, long, ...).   The result is unsigned int
40412042e2SAndrew Turner  * and must be cast to any desired pointer type.
41412042e2SAndrew Turner  */
42412042e2SAndrew Turner #define	_ALIGNBYTES	(sizeof(long long) - 1)
43412042e2SAndrew Turner #define	_ALIGN(p)	(((u_long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
44412042e2SAndrew Turner 
45412042e2SAndrew Turner #endif /* !_MACHINE__ALIGN_H_ */
46*d5d97bedSMike Karels 
47*d5d97bedSMike Karels #endif /* !__arm__ */
48