Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/architecture/i386/alignment.h

1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 *
5 * This file contains Original Code and/or Modifications of Original Code
6 * as defined in and that are subject to the Apple Public Source License
7 * Version 2.0 (the 'License'). You may not use this file except in
8 * compliance with the License. Please obtain a copy of the License at
9 * http://www.opensource.apple.com/apsl/ and read it before using this
10 * file.
11 *
12 * The Original Code and all software distributed under the License are
13 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 * Please see the License for the specific language governing rights and
18 * limitations under the License.
19 *
20 * Copyright (c) 1992 NeXT Computer, Inc.
21 *
22 * Natural alignment of shorts and longs (for i386)
23 *
24 * HISTORY
25 *
26 * 2 Sept 1992 Brian Raymor at NeXT
27 * Moved over to architecture.
28 * 18 August 1992 Jack Greenfield at NeXT
29 *Created.
30 */
31
32#ifndef _ARCH_I386_ALIGNMENT_H_
33#define _ARCH_I386_ALIGNMENT_H_
34
35/*
36 * NOP
37 */
38__inline__ static unsigned short
39get_align_short(void *ivalue)
40{
41 return *((unsigned short *) ivalue);
42}
43
44__inline__ static unsigned short
45put_align_short(unsigned short ivalue, void *ovalue)
46{
47 return *((unsigned short *) ovalue) = ivalue;
48}
49
50/*
51 * NOP
52 */
53__inline__ static unsigned long
54get_align_long(void *ivalue)
55{
56 return *((unsigned long *) ivalue);
57}
58
59__inline__ static unsigned long
60put_align_long(unsigned long ivalue, void *ovalue)
61{
62 return *((unsigned long *) ovalue) = ivalue;
63}
64
65#endif/* _ARCH_I386_ALIGNMENT_H_ */
66

Archive Download this file

Revision: 2045