xref: /f-stack/freebsd/mips/include/_align.h (revision 22ce4aff)
1a9643ea8Slogwang /*	$OpenBSD: param.h,v 1.11 1998/08/30 22:05:35 millert Exp $ */
2a9643ea8Slogwang 
3a9643ea8Slogwang /*-
4*22ce4affSfengbojiang  * SPDX-License-Identifier: BSD-3-Clause
5*22ce4affSfengbojiang  *
6a9643ea8Slogwang  * Copyright (c) 1988 University of Utah.
7a9643ea8Slogwang  * Copyright (c) 1992, 1993
8a9643ea8Slogwang  *	The Regents of the University of California.  All rights reserved.
9a9643ea8Slogwang  *
10a9643ea8Slogwang  * This code is derived from software contributed to Berkeley by
11a9643ea8Slogwang  * the Systems Programming Group of the University of Utah Computer
12a9643ea8Slogwang  * Science Department and Ralph Campbell.
13a9643ea8Slogwang  *
14a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
15a9643ea8Slogwang  * modification, are permitted provided that the following conditions
16a9643ea8Slogwang  * are met:
17a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright
18a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer.
19a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
20a9643ea8Slogwang  *    notice, this list of conditions and the following disclaimer in the
21a9643ea8Slogwang  *    documentation and/or other materials provided with the distribution.
22*22ce4affSfengbojiang  * 3. Neither the name of the University nor the names of its contributors
23a9643ea8Slogwang  *    may be used to endorse or promote products derived from this software
24a9643ea8Slogwang  *    without specific prior written permission.
25a9643ea8Slogwang  *
26a9643ea8Slogwang  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27a9643ea8Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28a9643ea8Slogwang  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29a9643ea8Slogwang  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30a9643ea8Slogwang  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31a9643ea8Slogwang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32a9643ea8Slogwang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33a9643ea8Slogwang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34a9643ea8Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35a9643ea8Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36a9643ea8Slogwang  * SUCH DAMAGE.
37a9643ea8Slogwang  *
38a9643ea8Slogwang  *	from: Utah Hdr: machparam.h 1.11 89/08/14
39a9643ea8Slogwang  *	from: @(#)param.h	8.1 (Berkeley) 6/10/93
40a9643ea8Slogwang  *	JNPR: param.h,v 1.6.2.1 2007/09/10 07:49:36 girish
41a9643ea8Slogwang  * $FreeBSD$
42a9643ea8Slogwang  */
43a9643ea8Slogwang 
44a9643ea8Slogwang #ifndef _MIPS_INCLUDE__ALIGN_H_
45a9643ea8Slogwang #define	_MIPS_INCLUDE__ALIGN_H_
46a9643ea8Slogwang 
47a9643ea8Slogwang /*
48a9643ea8Slogwang  * Round p (pointer or byte index) up to a correctly-aligned value for all
49a9643ea8Slogwang  * data types (int, long, ...).	  The result is u_long and must be cast to
50a9643ea8Slogwang  * any desired pointer type.
51a9643ea8Slogwang  */
52a9643ea8Slogwang #define	_ALIGNBYTES	7
53a9643ea8Slogwang #define	_ALIGN(p)	(((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
54a9643ea8Slogwang 
55a9643ea8Slogwang #endif /* !_MIPS_INCLUDE__ALIGN_H_ */
56