5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2, or (at
8 * your option) any later version.
11 #define __LITTLE_ENDIAN /* x86 */
13 /* Taken from /usr/include/linux/hfs_sysdep.h */
14 #if defined(__BIG_ENDIAN)
15 # if !defined(__constant_htonl)
16 # define __constant_htonl(x) (x)
18 # if !defined(__constant_htons)
19 # define __constant_htons(x) (x)
21 #elif defined(__LITTLE_ENDIAN)
22 # if !defined(__constant_htonl)
23 # define __constant_htonl(x) \
24 ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
25 (((unsigned long int)(x) & 0x0000ff00U) << 8) | \
26 (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
27 (((unsigned long int)(x) & 0xff000000U) >> 24)))
29 # if !defined(__constant_htons)
30 # define __constant_htons(x) \
31 ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
32 (((unsigned short int)(x) & 0xff00) >> 8)))
35 # error "Don't know if bytes are big- or little-endian!"
39 (__builtin_constant_p(x) ? \
40 __constant_htonl((x)) : \
43 (__builtin_constant_p(x) ? \
44 __constant_htonl((x)) : \
47 (__builtin_constant_p(x) ? \
48 __constant_htons((x)) : \
51 (__builtin_constant_p(x) ? \
52 __constant_htons((x)) : \
55 static inline unsigned long int __swap32(unsigned long int x
)
57 __asm__("xchgb %b0,%h0\n\t"
65 static inline unsigned short int __swap16(unsigned short int x
)
67 __asm__("xchgb %b0,%h0"
73 /* Make routines available to all */
74 #define swap32(x) __swap32(x)
75 #define swap16(x) __swap16(x)
77 #include "linux-asm-io.h"
79 typedef unsigned long Address
;
81 /* ANSI prototyping macro */