---
name: "gensio_bswap"
section: "3"
platform: "linux"
package: "gensio"
version: "3.0.4-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/gensio_bswap"
---

# gensio\_bswap(3)

Byte swapping routines.

## 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.

## 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

These routine perform normal byte swapping operations in 16, 32, and 64-bit values.  The **gensio\_bswap\_\[16\|32\|64\]()** perform an unconditional byte swap.  The **gensio\_bswap\_\[16\|32\|64\]\_\[from\|to\]\_\[be\|le\]** will byte swap from/to the given endianness depending on the host platforms endianness.

**GENSIO\_IS\_BIG\_ENDIAN** and **GENSIO\_IS\_LITTLE\_ENDIAN** will be true or false depending on the host endian's endianness.

## RETURN VALUES

The integer, byte swapped, will be returned.

## SEE ALSO

[gensio(5)](/gensio/5.md)
