KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Byte Order

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.
 

Functions

 arch_swap16 () is deprecated
 Swap the byte order of a 16-bit integer.
 
use __builtin_bswap16 ().") static inline uint16_t arch_swap16(uint16_t x)
 
 arch_swap32 () is deprecated
 Swap the byte order of a 32-bit integer.
 
use __builtin_bswap32 ().") static inline uint32_t arch_swap32(uint32_t x)
 
 arch_ntohs () is deprecated
 Convert network-to-host short.
 
use ntohs () from< arpa/inet.h >") static inline uint16_t arch_ntohs(uint16_t x)
 
 arch_ntohl () is deprecated
 Convert network-to-host long.
 
use ntohl () from< arpa/inet.h >") static inline uint32_t arch_ntohl(uint32_t x)
 
 arch_htons () is deprecated
 Convert host-to-network short.
 
use htons () from< arpa/inet.h >") static inline uint16_t arch_htons(uint16_t x)
 
 arch_htonl () is deprecated
 Convert host-to-network long.
 
use htonl () from< arpa/inet.h >") static inline uint32_t arch_htonl(uint32_t x)
 

Detailed Description

Byte-order management for the SH4 architecture

Macro Definition Documentation

◆ BYTE_ORDER

#define BYTE_ORDER   LITTLE_ENDIAN

Define the byte-order of the platform in use.

Function Documentation

◆ __builtin_bswap16()

use __builtin_bswap16 ( )

◆ __builtin_bswap32()

use __builtin_bswap32 ( )

◆ arch_htonl()

arch_htonl ( )

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
xThe value to be converted. This should be a uint32, or equivalent.
Returns
The converted value.

References __builtin_bswap32().

◆ arch_htons()

arch_htons ( )

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
xThe value to be converted. This should be a uint16, or equivalent.
Returns
The converted value.

References __builtin_bswap16().

◆ arch_ntohl()

arch_ntohl ( )

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
xThe value to be converted. This should be a uint32, or equivalent.
Returns
The converted value.

References __builtin_bswap32().

◆ arch_ntohs()

arch_ntohs ( )

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
xThe value to be converted. This should be a uint16, or equivalent.
Returns
The converted value.

References __builtin_bswap16().

◆ arch_swap16()

arch_swap16 ( )

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
xThe value to be byte-swapped. This should be a uint16, or equivalent.
Returns
The swapped value.

◆ arch_swap32()

arch_swap32 ( )

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
xThe value to be byte-swapped. This should be a uint32, or equivalent.
Returns
The swapped value.

◆ htonl()

use htonl ( )

Referenced by ntohl().

◆ htons()

use htons ( )

Referenced by ntohs().

◆ ntohl()

use ntohl ( )

◆ ntohs()

use ntohs ( )