Deleted Added
full compact
endian.h (127914) 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/amd64/include/endian.h 127914 2004-04-05 21:29:41Z imp $
30 * $FreeBSD: head/sys/amd64/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

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

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

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

58 */
59#if __BSD_VISIBLE
60#define LITTLE_ENDIAN _LITTLE_ENDIAN
61#define BIG_ENDIAN _BIG_ENDIAN
62#define PDP_ENDIAN _PDP_ENDIAN
63#define BYTE_ORDER _BYTE_ORDER
64#endif
65
66#ifdef __GNUC__
66#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
67
68#define __word_swap_int_var(x) \
69__extension__ ({ register __uint32_t __X = (x); \
70 __asm ("rorl $16, %0" : "+r" (__X)); \
71 __X; })
72
73#ifdef __OPTIMIZE__
74

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

172 return (__byte_swap_word(_x));
173}
174
175#define __htonl(x) __bswap32(x)
176#define __htons(x) __bswap16(x)
177#define __ntohl(x) __bswap32(x)
178#define __ntohs(x) __bswap16(x)
179
67
68#define __word_swap_int_var(x) \
69__extension__ ({ register __uint32_t __X = (x); \
70 __asm ("rorl $16, %0" : "+r" (__X)); \
71 __X; })
72
73#ifdef __OPTIMIZE__
74

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

172 return (__byte_swap_word(_x));
173}
174
175#define __htonl(x) __bswap32(x)
176#define __htons(x) __bswap16(x)
177#define __ntohl(x) __bswap32(x)
178#define __ntohs(x) __bswap16(x)
179
180#else /* !__GNUC__ */
180#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */
181
182/*
183 * No optimizations are available for this compiler. Fall back to
184 * non-optimized functions by defining the constant usually used to prevent
185 * redefinition.
186 */
187#define _BYTEORDER_FUNC_DEFINED
188
181
182/*
183 * No optimizations are available for this compiler. Fall back to
184 * non-optimized functions by defining the constant usually used to prevent
185 * redefinition.
186 */
187#define _BYTEORDER_FUNC_DEFINED
188
189#endif /* __GNUC__ */
189#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */
190
191#endif /* !_MACHINE_ENDIAN_H_ */
190
191#endif /* !_MACHINE_ENDIAN_H_ */