Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/architecture/ppc/alignment.h

Source at commit 1146 created 12 years 11 months ago.
By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing).
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Copyright (c) 1996 NeXT Software, Inc.
25 *
26 *File:architecture/ppc/alignment.h
27
28 * Natural alignment of shorts and longs (for ppc)
29 *
30 * HISTORY
31 *
32 * 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
33 *Ported from m98k.
34 * 2 Sept 1992 Brian Raymor at NeXT
35 * Moved over to architecture.
36 * 17 August 1992 Jack Greenfield at NeXT
37 *Created.
38 */
39
40__inline__ static unsigned short
41get_align_short(void *ivalue)
42{
43 unsigned shortovalue = ((unsigned char *) ivalue)[0];
44
45 ovalue <<= 8 * sizeof(unsigned char);
46 return ovalue + ((unsigned char *) ivalue)[1];
47}
48
49__inline__ static unsigned short
50put_align_short(unsigned short ivalue, void *ovalue)
51{
52 unsigned short*tvalue = &ivalue;
53
54 ((unsigned char *) ovalue)[0] = ((unsigned char *) tvalue)[0];
55 ((unsigned char *) ovalue)[1] = ((unsigned char *) tvalue)[1];
56 return ivalue;
57}
58
59__inline__ static unsigned long
60get_align_long(void *ivalue)
61{
62 unsigned longovalue = get_align_short(ivalue);
63
64 ovalue <<= 8 * sizeof(unsigned short);
65 return ovalue + get_align_short(((unsigned char *) ivalue) + sizeof(short));
66}
67
68__inline__ static unsigned long
69put_align_long(unsigned long ivalue, void *ovalue)
70{
71 unsigned long*tvalue = &ivalue;
72
73 ((unsigned char *) ovalue)[0] = ((unsigned char *) tvalue)[0];
74 ((unsigned char *) ovalue)[1] = ((unsigned char *) tvalue)[1];
75 ((unsigned char *) ovalue)[2] = ((unsigned char *) tvalue)[2];
76 ((unsigned char *) ovalue)[3] = ((unsigned char *) tvalue)[3];
77 return ivalue;
78}
79
80

Archive Download this file

Revision: 1146