1SWAB(3)                    Linux Programmer's Manual                   SWAB(3)
2
3
4

NAME

6       swab - swap adjacent bytes
7

SYNOPSIS

9       #define _XOPEN_SOURCE       /* See feature_test_macros(7) */
10       #include <unistd.h>
11
12       void swab(const void *restrict from, void *restrict to, ssize_t n);
13

DESCRIPTION

15       The swab() function copies n bytes from the array pointed to by from to
16       the array pointed to by to, exchanging adjacent  even  and  odd  bytes.
17       This  function is used to exchange data between machines that have dif‐
18       ferent low/high byte ordering.
19
20       This function does nothing when n is negative.  When n is positive  and
21       odd, it handles n-1 bytes as above, and does something unspecified with
22       the last byte.  (In other words, n should be even.)
23

RETURN VALUE

25       The swab() function returns no value.
26

ATTRIBUTES

28       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
29       tributes(7).
30
31       ┌────────────────────────────────────────────┬───────────────┬─────────┐
32Interface                                   Attribute     Value   
33       ├────────────────────────────────────────────┼───────────────┼─────────┤
34swab()                                      │ Thread safety │ MT-Safe │
35       └────────────────────────────────────────────┴───────────────┴─────────┘
36

CONFORMING TO

38       POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
39

SEE ALSO

41       bstring(3)
42

COLOPHON

44       This  page  is  part of release 5.12 of the Linux man-pages project.  A
45       description of the project, information about reporting bugs,  and  the
46       latest     version     of     this    page,    can    be    found    at
47       https://www.kernel.org/doc/man-pages/.
48
49
50
51                                  2021-03-22                           SWAB(3)
Impressum