1ce4ec51dSTijl Coosemans /*- 2*df57947fSPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 3*df57947fSPedro F. Giffuni * 4ce4ec51dSTijl Coosemans * Copyright (c) 2001 David E. O'Brien 5ce4ec51dSTijl Coosemans * Copyright (c) 1990 The Regents of the University of California. 6ce4ec51dSTijl Coosemans * All rights reserved. 7ce4ec51dSTijl Coosemans * 8ce4ec51dSTijl Coosemans * This code is derived from software contributed to Berkeley by 9ce4ec51dSTijl Coosemans * William Jolitz. 10ce4ec51dSTijl Coosemans * 11ce4ec51dSTijl Coosemans * Redistribution and use in source and binary forms, with or without 12ce4ec51dSTijl Coosemans * modification, are permitted provided that the following conditions 13ce4ec51dSTijl Coosemans * are met: 14ce4ec51dSTijl Coosemans * 1. Redistributions of source code must retain the above copyright 15ce4ec51dSTijl Coosemans * notice, this list of conditions and the following disclaimer. 16ce4ec51dSTijl Coosemans * 2. Redistributions in binary form must reproduce the above copyright 17ce4ec51dSTijl Coosemans * notice, this list of conditions and the following disclaimer in the 18ce4ec51dSTijl Coosemans * documentation and/or other materials provided with the distribution. 19ce4ec51dSTijl Coosemans * 3. All advertising materials mentioning features or use of this software 20ce4ec51dSTijl Coosemans * must display the following acknowledgement: 21ce4ec51dSTijl Coosemans * This product includes software developed by the University of 22ce4ec51dSTijl Coosemans * California, Berkeley and its contributors. 23ce4ec51dSTijl Coosemans * 4. Neither the name of the University nor the names of its contributors 24ce4ec51dSTijl Coosemans * may be used to endorse or promote products derived from this software 25ce4ec51dSTijl Coosemans * without specific prior written permission. 26ce4ec51dSTijl Coosemans * 27ce4ec51dSTijl Coosemans * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28ce4ec51dSTijl Coosemans * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29ce4ec51dSTijl Coosemans * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30ce4ec51dSTijl Coosemans * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31ce4ec51dSTijl Coosemans * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32ce4ec51dSTijl Coosemans * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33ce4ec51dSTijl Coosemans * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34ce4ec51dSTijl Coosemans * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35ce4ec51dSTijl Coosemans * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36ce4ec51dSTijl Coosemans * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37ce4ec51dSTijl Coosemans * SUCH DAMAGE. 38ce4ec51dSTijl Coosemans */ 39ce4ec51dSTijl Coosemans 40ce4ec51dSTijl Coosemans #ifndef _X86_INCLUDE__ALIGN_H_ 41ce4ec51dSTijl Coosemans #define _X86_INCLUDE__ALIGN_H_ 42ce4ec51dSTijl Coosemans 43ce4ec51dSTijl Coosemans /* 44ce4ec51dSTijl Coosemans * Round p (pointer or byte index) up to a correctly-aligned value 45ce4ec51dSTijl Coosemans * for all data types (int, long, ...). The result is unsigned int 46ce4ec51dSTijl Coosemans * and must be cast to any desired pointer type. 47ce4ec51dSTijl Coosemans */ 483a45c3d6SEd Schouten #define _ALIGNBYTES (sizeof(__register_t) - 1) 493a45c3d6SEd Schouten #define _ALIGN(p) (((__uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) 50ce4ec51dSTijl Coosemans 51ce4ec51dSTijl Coosemans #endif /* !_X86_INCLUDE__ALIGN_H_ */ 52