Deleted Added
full compact
endian.h (128019) endian.h (143063)
1/*-
2 * Copyright (c) 1987, 1991, 1993
3 * The Regents of the University of California. 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

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

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 8.1 (Berkeley) 6/10/93
30 * $NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp $
1/*-
2 * Copyright (c) 1987, 1991, 1993
3 * The Regents of the University of California. 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

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

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 8.1 (Berkeley) 6/10/93
30 * $NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp $
31 * $FreeBSD: head/sys/ia64/include/endian.h 128019 2004-04-07 20:46:16Z imp $
31 * $FreeBSD: head/sys/ia64/include/endian.h 143063 2005-03-02 21:33:29Z joerg $
32 */
33
34#ifndef _MACHINE_ENDIAN_H_
35#define _MACHINE_ENDIAN_H_
36
37#include <sys/cdefs.h>
38#include <sys/_types.h>
39

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

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

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

59 */
60#if __BSD_VISIBLE
61#define LITTLE_ENDIAN _LITTLE_ENDIAN
62#define BIG_ENDIAN _BIG_ENDIAN
63#define PDP_ENDIAN _PDP_ENDIAN
64#define BYTE_ORDER _BYTE_ORDER
65#endif
66
67#ifdef __GNUC__
67#if defined(__CC_SUPPORTS___INLINE) && defined(__GNUCLIKE_ASM)
68
69static __inline __uint64_t
70__bswap64(__uint64_t _x)
71{
72 __uint64_t __r;
73
74 __asm __volatile("mux1 %0=%1,@rev"
75 : "=r" (__r) : "r"(_x));

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

90 return (__bswap64(_x) >> 48);
91}
92
93#define __htonl(x) __bswap32(x)
94#define __htons(x) __bswap16(x)
95#define __ntohl(x) __bswap32(x)
96#define __ntohs(x) __bswap16(x)
97
68
69static __inline __uint64_t
70__bswap64(__uint64_t _x)
71{
72 __uint64_t __r;
73
74 __asm __volatile("mux1 %0=%1,@rev"
75 : "=r" (__r) : "r"(_x));

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

90 return (__bswap64(_x) >> 48);
91}
92
93#define __htonl(x) __bswap32(x)
94#define __htons(x) __bswap16(x)
95#define __ntohl(x) __bswap32(x)
96#define __ntohs(x) __bswap16(x)
97
98#else /* !__GNUC__ */
98#else /* !(__CC_SUPPORTS___INLINE && __GNUCLIKE_ASM) */
99
100/*
101 * No optimizations are available for this compiler. Fall back to
102 * non-optimized functions by defining the constant usually used to prevent
103 * redefinition.
104 */
105#define _BYTEORDER_FUNC_DEFINED
106
99
100/*
101 * No optimizations are available for this compiler. Fall back to
102 * non-optimized functions by defining the constant usually used to prevent
103 * redefinition.
104 */
105#define _BYTEORDER_FUNC_DEFINED
106
107#endif /* __GNUC__ */
107#endif /* __CC_SUPPORTS___INLINE && __GNUCLIKE_ASM */
108
109#endif /* !_MACHINE_ENDIAN_H_ */
108
109#endif /* !_MACHINE_ENDIAN_H_ */