logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

swab - swap adjacent bytes

Attributes

       For an explanation of the terms used in this section, see attributes(7).
       ┌─────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
       │ InterfaceAttributeValue   │
       ├─────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
       │ swab()                                                                      │ Thread safety │ MT-Safe │
       └─────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘

Description

       The  swab()  function  copies  n  bytes  from the array pointed to by from to the array pointed to by to,
       exchanging adjacent even and odd bytes.  This function is used to exchange  data  between  machines  that
       have different low/high byte ordering.

       This  function  does  nothing  when  n  is negative.  When n is positive and odd, it handles n-1 bytes as
       above, and does something unspecified with the last byte.  (In other words, n should be even.)

History

       POSIX.1-2001, SVr4, 4.3BSD.

Library

       Standard C library (libc, -lc)

Name

       swab - swap adjacent bytes

Return Value

       The swab() function returns no value.

See Also

bstring(3)

Linux man-pages 6.9.1                              2024-05-02                                            swab(3)

Standards

       POSIX.1-2008.

Synopsis

#define_XOPEN_SOURCE       /* See feature_test_macros(7) */
       #include<unistd.h>voidswab(constvoidfrom[restrict.n],voidto[restrict.n],ssize_tn);

See Also