Byte-order management for the SH4 architecture
More...
|
| static uint16_t | arch_swap16 (uint16_t x) |
| | Swap the byte order of a 16-bit integer.
|
| |
| static uint32_t | arch_swap32 (uint32_t x) |
| | Swap the byte order of a 32-bit integer.
|
| |
| static uint16_t | arch_ntohs (uint16_t x) |
| | Convert network-to-host short.
|
| |
| static uint32_t | arch_ntohl (uint32_t x) |
| | Convert network-to-host long.
|
| |
| static uint16_t | arch_htons (uint16_t x) |
| | Convert host-to-network short.
|
| |
| static uint32_t | arch_htonl (uint32_t x) |
| | Convert host-to-network long.
|
| |
Byte-order management for the SH4 architecture
◆ BYTE_ORDER
Define the byte-order of the platform in use.
◆ arch_htonl()
| static uint32_t arch_htonl |
( |
uint32_t | x | ) |
|
|
inlinestatic |
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.
- Parameters
-
| x | The value to be converted. This should be a uint32, or equivalent. |
- Returns
- The converted value.
◆ arch_htons()
| static uint16_t arch_htons |
( |
uint16_t | x | ) |
|
|
inlinestatic |
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.
- Parameters
-
| x | The value to be converted. This should be a uint16, or equivalent. |
- Returns
- The converted value.
◆ arch_ntohl()
| static uint32_t arch_ntohl |
( |
uint32_t | x | ) |
|
|
inlinestatic |
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.
- Parameters
-
| x | The value to be converted. This should be a uint32, or equivalent. |
- Returns
- The converted value.
◆ arch_ntohs()
| static uint16_t arch_ntohs |
( |
uint16_t | x | ) |
|
|
inlinestatic |
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.
- Parameters
-
| x | The value to be converted. This should be a uint16, or equivalent. |
- Returns
- The converted value.
◆ arch_swap16()
| static uint16_t arch_swap16 |
( |
uint16_t | x | ) |
|
|
inlinestatic |
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.
- Parameters
-
| x | The value to be byte-swapped. This should be a uint16, or equivalent. |
- Returns
- The swapped value.
◆ arch_swap32()
| static uint32_t arch_swap32 |
( |
uint32_t | x | ) |
|
|
inlinestatic |
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.
- Parameters
-
| x | The value to be byte-swapped. This should be a uint32, or equivalent. |
- Returns
- The swapped value.