Be careful not to define GCC-specific optimizations in the non-GCC

case.
This commit is contained in:
mike 2002-09-23 04:32:17 +00:00
parent f7b3bc6b89
commit 4fff97516c
6 changed files with 66 additions and 12 deletions

View File

@ -112,11 +112,20 @@ __bswap16(__uint16_t __x)
return (__r);
}
#endif /* __GNUC__ */
#define __htonl(x) __bswap32(x)
#define __htons(x) __bswap16(x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !__GNUC__ */
/*
* No optimizations are available for this compiler. Fall back to
* non-optimized functions by defining the constant usually used to prevent
* redefinition.
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -109,11 +109,20 @@ __bswap16(__uint16_t _x)
return (__byte_swap_word(_x));
}
#endif /* __GNUC__ */
#define __htonl(x) __bswap32(x)
#define __htons(x) __bswap16(x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !__GNUC__ */
/*
* No optimizations are available for this compiler. Fall back to
* non-optimized functions by defining the constant usually used to prevent
* redefinition.
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -117,11 +117,20 @@ __bswap16(__uint16_t _x)
return (__byte_swap_word(_x));
}
#endif /* __GNUC__ */
#define __htonl(x) __bswap32(x)
#define __htons(x) __bswap16(x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !__GNUC__ */
/*
* No optimizations are available for this compiler. Fall back to
* non-optimized functions by defining the constant usually used to prevent
* redefinition.
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -93,11 +93,20 @@ __bswap16(__uint16_t __x)
return (__bswap64(__x) >> 48);
}
#endif /* __GNUC__ */
#define __htonl(x) __bswap32(x)
#define __htons(x) __bswap16(x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !__GNUC__ */
/*
* No optimizations are available for this compiler. Fall back to
* non-optimized functions by defining the constant usually used to prevent
* redefinition.
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -95,11 +95,20 @@ __bswap64(__uint64_t _x)
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
}
#endif /* __GNUC__ */
#define __htonl(x) ((__uint32_t)(x))
#define __htons(x) ((__uint16_t)(x))
#define __ntohl(x) ((__uint32_t)(x))
#define __ntohs(x) ((__uint16_t)(x))
#else /* !__GNUC__ */
/*
* No optimizations are available for this compiler. Fall back to
* non-optimized functions by defining the constant usually used to prevent
* redefinition.
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -94,11 +94,20 @@ __bswap64(__uint64_t _x)
((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
}
#endif /* __GNUC__ */
#define __htonl(x) ((__uint32_t)(x))
#define __htons(x) ((__uint16_t)(x))
#define __ntohl(x) ((__uint32_t)(x))
#define __ntohs(x) ((__uint16_t)(x))
#else /* !__GNUC__ */
/*
* No optimizations are available for this compiler. Fall back to
* non-optimized functions by defining the constant usually used to prevent
* redefinition.
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* !_MACHINE_ENDIAN_H_ */