Deleted Added
full compact
endian.h (137784) endian.h (143063)
1/*-
2 * Copyright (c) 1987, 1991 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)endian.h 7.8 (Berkeley) 4/3/91
1/*-
2 * Copyright (c) 1987, 1991 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)endian.h 7.8 (Berkeley) 4/3/91
30 * $FreeBSD: head/sys/i386/include/endian.h 137784 2004-11-16 20:42:32Z jhb $
30 * $FreeBSD: head/sys/i386/include/endian.h 143063 2005-03-02 21:33:29Z joerg $
31 */
32
33#ifndef _MACHINE_ENDIAN_H_
34#define _MACHINE_ENDIAN_H_
35
36#include <sys/cdefs.h>
37#include <sys/_types.h>
38

--- 23 unchanged lines hidden (view full) ---

62 */
63#if __BSD_VISIBLE
64#define LITTLE_ENDIAN _LITTLE_ENDIAN
65#define BIG_ENDIAN _BIG_ENDIAN
66#define PDP_ENDIAN _PDP_ENDIAN
67#define BYTE_ORDER _BYTE_ORDER
68#endif
69
31 */
32
33#ifndef _MACHINE_ENDIAN_H_
34#define _MACHINE_ENDIAN_H_
35
36#include <sys/cdefs.h>
37#include <sys/_types.h>
38

--- 23 unchanged lines hidden (view full) ---

62 */
63#if __BSD_VISIBLE
64#define LITTLE_ENDIAN _LITTLE_ENDIAN
65#define BIG_ENDIAN _BIG_ENDIAN
66#define PDP_ENDIAN _PDP_ENDIAN
67#define BYTE_ORDER _BYTE_ORDER
68#endif
69
70#if defined(__INTEL_COMPILER)
71#if defined(__cplusplus)
72#if __INTEL_COMPILER >= 800
73#define __INTEL_COMPILER_with_FreeBSD_endian 1
74#endif
75#else
76#define __INTEL_COMPILER_with_FreeBSD_endian 1
77#endif
78#endif
70#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
79
71
80#if defined(__GNUC__) || defined(__INTEL_COMPILER_with_FreeBSD_endian)
81
82#define __word_swap_int_var(x) \
83__extension__ ({ register __uint32_t __X = (x); \
84 __asm ("rorl $16, %0" : "+r" (__X)); \
85 __X; })
86
87#ifdef __OPTIMIZE__
88
89#define __word_swap_int_const(x) \

--- 73 unchanged lines hidden (view full) ---

163 return (__byte_swap_word(_x));
164}
165
166#define __htonl(x) __bswap32(x)
167#define __htons(x) __bswap16(x)
168#define __ntohl(x) __bswap32(x)
169#define __ntohs(x) __bswap16(x)
170
72#define __word_swap_int_var(x) \
73__extension__ ({ register __uint32_t __X = (x); \
74 __asm ("rorl $16, %0" : "+r" (__X)); \
75 __X; })
76
77#ifdef __OPTIMIZE__
78
79#define __word_swap_int_const(x) \

--- 73 unchanged lines hidden (view full) ---

153 return (__byte_swap_word(_x));
154}
155
156#define __htonl(x) __bswap32(x)
157#define __htons(x) __bswap16(x)
158#define __ntohl(x) __bswap32(x)
159#define __ntohs(x) __bswap16(x)
160
171#else /* !(__GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian) */
161#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */
172
173/*
174 * No optimizations are available for this compiler. Fall back to
175 * non-optimized functions by defining the constant usually used to prevent
176 * redefinition.
177 */
178#define _BYTEORDER_FUNC_DEFINED
179
162
163/*
164 * No optimizations are available for this compiler. Fall back to
165 * non-optimized functions by defining the constant usually used to prevent
166 * redefinition.
167 */
168#define _BYTEORDER_FUNC_DEFINED
169
180#endif /* __GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian */
170#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */
181
182#ifdef __cplusplus
183}
184#endif
185
186#endif /* !_MACHINE_ENDIAN_H_ */
171
172#ifdef __cplusplus
173}
174#endif
175
176#endif /* !_MACHINE_ENDIAN_H_ */