Lines 122-128
Link Here
|
122 |
#define be16_to_cpus __be16_to_cpus |
122 |
#define be16_to_cpus __be16_to_cpus |
123 |
#endif |
123 |
#endif |
124 |
|
124 |
|
125 |
|
125 |
#if defined(__KERNEL__) |
126 |
/* |
126 |
/* |
127 |
* Handle ntohl and suches. These have various compatibility |
127 |
* Handle ntohl and suches. These have various compatibility |
128 |
* issues - like we want to give the prototype even though we |
128 |
* issues - like we want to give the prototype even though we |
Lines 146-180
Link Here
|
146 |
* Do the prototypes. Somebody might want to take the |
146 |
* Do the prototypes. Somebody might want to take the |
147 |
* address or some such sick thing.. |
147 |
* address or some such sick thing.. |
148 |
*/ |
148 |
*/ |
149 |
#if defined(__KERNEL__) || (defined (__GLIBC__) && __GLIBC__ >= 2) |
|
|
150 |
extern __u32 ntohl(__u32); |
149 |
extern __u32 ntohl(__u32); |
151 |
extern __u32 htonl(__u32); |
150 |
extern __u32 htonl(__u32); |
152 |
#else |
|
|
153 |
extern unsigned long int ntohl(unsigned long int); |
154 |
extern unsigned long int htonl(unsigned long int); |
155 |
#endif |
156 |
extern unsigned short int ntohs(unsigned short int); |
151 |
extern unsigned short int ntohs(unsigned short int); |
157 |
extern unsigned short int htons(unsigned short int); |
152 |
extern unsigned short int htons(unsigned short int); |
158 |
|
153 |
|
159 |
|
154 |
#if defined(__GNUC__) && defined(__OPTIMIZE__) |
160 |
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) && !defined(__STRICT_ANSI__) |
|
|
161 |
|
155 |
|
162 |
#define ___htonl(x) __cpu_to_be32(x) |
156 |
#define ___htonl(x) __cpu_to_be32(x) |
163 |
#define ___htons(x) __cpu_to_be16(x) |
157 |
#define ___htons(x) __cpu_to_be16(x) |
164 |
#define ___ntohl(x) __be32_to_cpu(x) |
158 |
#define ___ntohl(x) __be32_to_cpu(x) |
165 |
#define ___ntohs(x) __be16_to_cpu(x) |
159 |
#define ___ntohs(x) __be16_to_cpu(x) |
166 |
|
160 |
|
167 |
#if defined(__KERNEL__) || (defined (__GLIBC__) && __GLIBC__ >= 2) |
|
|
168 |
#define htonl(x) ___htonl(x) |
161 |
#define htonl(x) ___htonl(x) |
169 |
#define ntohl(x) ___ntohl(x) |
162 |
#define ntohl(x) ___ntohl(x) |
170 |
#else |
|
|
171 |
#define htonl(x) ((unsigned long)___htonl(x)) |
172 |
#define ntohl(x) ((unsigned long)___ntohl(x)) |
173 |
#endif |
174 |
#define htons(x) ___htons(x) |
163 |
#define htons(x) ___htons(x) |
175 |
#define ntohs(x) ___ntohs(x) |
164 |
#define ntohs(x) ___ntohs(x) |
176 |
|
165 |
|
177 |
#endif /* OPTIMIZE */ |
166 |
#endif /* OPTIMIZE */ |
178 |
|
167 |
|
|
|
168 |
#endif /* KERNEL */ |
169 |
|
179 |
|
170 |
|
180 |
#endif /* _LINUX_BYTEORDER_GENERIC_H */ |
171 |
#endif /* _LINUX_BYTEORDER_GENERIC_H */ |