gensio_bswap(3)

πŸ’– gensio_bswap β€” the Library Functions Manual, but make it cute πŸ’–

okay bestie, this is gensio_bswap(3) from the Library Functions Manual and it's literally just byte swapping, no drama, and honestly? slay. let's get into it πŸ¦‹


✨ NAME ✨

gensio_bswap_16, gensio_bswap_32, gensio_bswap_64, GENSIO_IS_BIG_ENDIAN, GENSIO_IS_LITTLE_ENDIAN, gensio_bswap_16_from_be, gensio_bswap_32_from_be, gensio_bswap_64_from_be, gensio_bswap_16_to_be, gensio_bswap_32_to_be, gensio_bswap_64_to_be, gensio_bswap_16_from_le, gensio_bswap_32_from_le, gensio_bswap_64_from_le, gensio_bswap_16_to_le, gensio_bswap_32_to_le, gensio_bswap_64_to_le β€” Byte swapping routines. periodt. πŸ’…


🌈 SYNOPSIS 🌈

#include <gensio/gensio_byteswap.h>

uint[16|32|64]_t gensio_bswap_[16|32|64](v)

uint[16|32|64]_t gensio_bswap_[16|32|64]_[from|to]_[be|le](v)

πŸŽ€ DESCRIPTION πŸŽ€

so these routines do the normal byte swapping thing in 16, 32, and 64-bit values. classic. iconic. no cap.

  • gensio_bswap_[16|32|64]() β€” this one does an unconditional byte swap. it does not care about your host, it does not read the room, it just swaps. main character energy fr fr πŸ”₯
  • gensio_bswap_[16|32|64]_[from|to]_[be|le] β€” these cuties byte swap from/to the given endianness, and the actual swapping that happens depends on your host platform's endianness. iykyk πŸ‘‘
  • GENSIO_IS_BIG_ENDIAN and GENSIO_IS_LITTLE_ENDIAN β€” these will be true or false depending on the host endian's endianness. yes bestie, the vibes check your machine for you 🫢

⭐ RETURN VALUES ⭐

the integer, byte swapped, will be returned. that's it, that's the whole return value, and honestly it ate πŸ’–


🌸 SEE ALSO 🌸

gensio(5)


and that's the whole page bestie, go forth and swap those bytes responsibly 🧚

this gem is from gensio_bswap(3) and the footer says 04 Jan 2025 β€” so if your byte order is looking a little cursed, blame the date, not me πŸ’€βœ¨
πŸ“¦ where this page comes from