Deleted Added
full compact
endian.h (127977) 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.7 1999/08/21 05:53:51 simonb 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.7 1999/08/21 05:53:51 simonb Exp $
31 * $FreeBSD: head/sys/powerpc/include/endian.h 127977 2004-04-07 05:00:01Z imp $
31 * $FreeBSD: head/sys/powerpc/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

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

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

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

60 */
61#if __BSD_VISIBLE
62#define LITTLE_ENDIAN _LITTLE_ENDIAN
63#define BIG_ENDIAN _BIG_ENDIAN
64#define PDP_ENDIAN _PDP_ENDIAN
65#define BYTE_ORDER _BYTE_ORDER
66#endif
67
68#ifdef __GNUC__
68#ifdef __CC_SUPPORTS___INLINE
69
70static __inline __uint16_t
71__bswap16(__uint16_t _x)
72{
73
74 return ((_x >> 8) | ((_x << 8) & 0xff00));
75}
76

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

92 ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
93}
94
95#define __htonl(x) ((__uint32_t)(x))
96#define __htons(x) ((__uint16_t)(x))
97#define __ntohl(x) ((__uint32_t)(x))
98#define __ntohs(x) ((__uint16_t)(x))
99
69
70static __inline __uint16_t
71__bswap16(__uint16_t _x)
72{
73
74 return ((_x >> 8) | ((_x << 8) & 0xff00));
75}
76

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

92 ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
93}
94
95#define __htonl(x) ((__uint32_t)(x))
96#define __htons(x) ((__uint16_t)(x))
97#define __ntohl(x) ((__uint32_t)(x))
98#define __ntohs(x) ((__uint16_t)(x))
99
100#else /* !__GNUC__ */
100#else /* !__CC_SUPPORTS___INLINE */
101
102/*
103 * No optimizations are available for this compiler. Fall back to
104 * non-optimized functions by defining the constant usually used to prevent
105 * redefinition.
106 */
107#define _BYTEORDER_FUNC_DEFINED
108
101
102/*
103 * No optimizations are available for this compiler. Fall back to
104 * non-optimized functions by defining the constant usually used to prevent
105 * redefinition.
106 */
107#define _BYTEORDER_FUNC_DEFINED
108
109#endif /* __GNUC__ */
109#endif /* __CC_SUPPORTS___INLINE */
110
111#endif /* !_MACHINE_ENDIAN_H_ */
110
111#endif /* !_MACHINE_ENDIAN_H_ */