KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Byte-order management for the SH4 architecture More...
Files | |
file | byteorder.h |
Byte-order related macros. | |
Macros | |
#define | BYTE_ORDER LITTLE_ENDIAN |
Define the byte-order of the platform in use. | |
#define | arch_swap16(x) |
Swap the byte order of a 16-bit integer. | |
#define | arch_swap32(x) |
Swap the byte order of a 32-bit integer. | |
#define | arch_ntohs(x) arch_swap16(x) |
Convert network-to-host short. | |
#define | arch_ntohl(x) arch_swap32(x) |
Convert network-to-host long. | |
#define | arch_htons(x) arch_swap16(x) |
Convert host-to-network short. | |
#define | arch_htonl(x) arch_swap32(x) |
Convert host-to-network long. | |
Byte-order management for the SH4 architecture
#define arch_htonl | ( | x | ) | arch_swap32(x) |
Convert host-to-network long.
This macro converts a value in the host's native byte order to network byte order (big endian). On a little endian system (like the Dreamcast), this should just call arch_swap32(). On a big endian system, this should be a no-op.
x | The value to be converted. This should be a uint32, or equivalent. |
#define arch_htons | ( | x | ) | arch_swap16(x) |
Convert host-to-network short.
This macro converts a value in the host's native byte order to network byte order (big endian). On a little endian system (like the Dreamcast), this should just call arch_swap16(). On a big endian system, this should be a no-op.
x | The value to be converted. This should be a uint16, or equivalent. |
#define arch_ntohl | ( | x | ) | arch_swap32(x) |
Convert network-to-host long.
This macro converts a network byte order (big endian) value to the host's native byte order. On a little endian system (like the Dreamcast), this should just call arch_swap32(). On a big endian system, this should be a no-op.
x | The value to be converted. This should be a uint32, or equivalent. |
#define arch_ntohs | ( | x | ) | arch_swap16(x) |
Convert network-to-host short.
This macro converts a network byte order (big endian) value to the host's native byte order. On a little endian system (like the Dreamcast), this should just call arch_swap16(). On a big endian system, this should be a no-op.
x | The value to be converted. This should be a uint16, or equivalent. |
#define arch_swap16 | ( | x | ) |
Swap the byte order of a 16-bit integer.
This macro swaps the byte order of a 16-bit integer in an architecture- defined manner.
x | The value to be byte-swapped. This should be a uint16, or equivalent. |
#define arch_swap32 | ( | x | ) |
Swap the byte order of a 32-bit integer.
This macro swaps the byte order of a 32-bit integer in an architecture- defined manner.
x | The value to be byte-swapped. This should be a uint32, or equivalent. |
#define BYTE_ORDER LITTLE_ENDIAN |
Define the byte-order of the platform in use.