]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/OSCrossEndian.h
2d04f44d67d6c764ab2680b3f4a9a7a2bafc2efc
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This 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 OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
24 * This private header exports 3 APIs.
25 * _OSRosettaCheck() - An inline function that returns true if we are
26 * currently running under Rosetta.
27 * IF_ROSETTA() - Which is used to as a regular conditional
28 * expression that is true only if the current
29 * code is executing in the Rosetta
31 * ROSETTA_ONLY(exprs) - Which is used to create a block code that only
32 * executes if we are running in Rosetta.
37 * // Do Cross endian swapping of input data
38 * outdata = OSSwap??(indata);
41 * // Do straight through
47 * // Do Cross endian swapping of input data
48 * outdata = OSSwap??(outdata);
52 #ifndef _LIBKERN_OSCROSSENDIAN_H
53 #define _LIBKERN_OSCROSSENDIAN_H
57 static __inline__
int _OSRosettaCheck(void)
59 int isCrossEndian
= 0;
67 static __inline__
int _OSRosettaCheck(void) { return 0; }
71 #define IF_ROSETTA() if (__builtin_expect(_OSRosettaCheck(), 0) )
73 #define ROSETTA_ONLY(exprs) \
80 #endif /* _LIBKERN_OSCROSSENDIAN_H */