Byte-Swapping Builtins (Using the GNU Compiler Collection (GCC)) (original) (raw)
7.2.3 Byte-Swapping Builtins ¶
Built-in Function: uint16_t
__builtin_bswap16 (uint16_t x)
¶
Returns x with the order of the bytes reversed; for example,0xabcd
becomes 0xcdab
. Byte here always means exactly 8 bits.
Built-in Function: uint32_t
__builtin_bswap32 (uint32_t x)
¶
Similar to __builtin_bswap16
, except the argument and return types are 32-bit.
Built-in Function: uint64_t
__builtin_bswap64 (uint64_t x)
¶
Similar to __builtin_bswap32
, except the argument and return types are 64-bit.
Built-in Function: uint128_t
__builtin_bswap128 (uint128_t x)
¶
Similar to __builtin_bswap64
, except the argument and return types are 128-bit. Only supported on targets when 128-bit types are supported.