Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/_endian.h
Show All 30 Lines | |||||
#ifndef _SYS__ENDIAN_H_ | #ifndef _SYS__ENDIAN_H_ | ||||
#define _SYS__ENDIAN_H_ | #define _SYS__ENDIAN_H_ | ||||
#if !defined(_MACHINE_ENDIAN_H_) && !defined(_BYTESWAP_H_) && !defined(_ENDIAN_H_) | #if !defined(_MACHINE_ENDIAN_H_) && !defined(_BYTESWAP_H_) && !defined(_ENDIAN_H_) | ||||
#error "sys/_endian.h should not be included directly" | #error "sys/_endian.h should not be included directly" | ||||
#endif | #endif | ||||
#include <sys/cdefs.h> /* visibility macros */ | |||||
/* BSD Compatiblity */ | /* BSD Compatiblity */ | ||||
#define _BYTE_ORDER __BYTE_ORDER__ | #define _BYTE_ORDER __BYTE_ORDER__ | ||||
/* | /* | ||||
* Definitions for byte order, according to byte significance from low | * Definitions for byte order, according to byte significance from low | ||||
* address to high. We undefine any prior definition of them because | * address to high. We undefine any prior definition of them because | ||||
* powerpc compilers define _LITTLE_ENDIAN and _BIG_ENDIAN to mean | * powerpc compilers define _LITTLE_ENDIAN and _BIG_ENDIAN to mean | ||||
* something else. | * something else. | ||||
Show All 14 Lines | |||||
#elif _BYTE_ORDER == _BIG_ENDIAN | #elif _BYTE_ORDER == _BIG_ENDIAN | ||||
#define _QUAD_HIGHWORD 0 | #define _QUAD_HIGHWORD 0 | ||||
#define _QUAD_LOWWORD 1 | #define _QUAD_LOWWORD 1 | ||||
#else | #else | ||||
#error "Unsupported endian" | #error "Unsupported endian" | ||||
#endif | #endif | ||||
/* | /* | ||||
* Deprecated variants that don't have enough underscores to be useful in more | * POSIX Issue 8 will require these for endian.h. Define them there and in the | ||||
* strict namespaces. | * traditional BSD compilation environment. Since issue 8 doesn't yet have an | ||||
* assigned date, use strictly greater than issue 7's date. | |||||
*/ | */ | ||||
#if __BSD_VISIBLE | #if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809 | ||||
emaste: so we're using anything past `200809` to mean Issue 8?
I think it wouldn't hurt to extend this… | |||||
Done Inline ActionsOK. The comment was supposed to do that, but I'll add a few more words to make it explicit. imp: OK. The comment was supposed to do that, but I'll add a few more words to make it explicit. | |||||
#define LITTLE_ENDIAN _LITTLE_ENDIAN | #define LITTLE_ENDIAN _LITTLE_ENDIAN | ||||
#define BIG_ENDIAN _BIG_ENDIAN | #define BIG_ENDIAN _BIG_ENDIAN | ||||
#define PDP_ENDIAN _PDP_ENDIAN | #define PDP_ENDIAN _PDP_ENDIAN | ||||
#define BYTE_ORDER _BYTE_ORDER | #define BYTE_ORDER _BYTE_ORDER | ||||
#endif | #endif | ||||
/* bswap primitives, based on compiler builtins */ | /* bswap primitives, based on compiler builtins */ | ||||
#define __bswap16(x) __builtin_bswap16(x) | #define __bswap16(x) __builtin_bswap16(x) | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |
so we're using anything past 200809 to mean Issue 8?
I think it wouldn't hurt to extend this comment to clarify.