1swab(9F)                 Kernel Functions for Drivers                 swab(9F)
2
3
4

NAME

6       swab - swap bytes in 16-bit halfwords
7

SYNOPSIS

9       #include <sys/sunddi.h>
10
11
12
13       void swab(void *src, void *dst, size_t nbytes);
14
15

INTERFACE LEVEL

17       Architecture independent level 1 (DDI/DKI).
18

PARAMETERS

20       src       A pointer to the buffer containing the bytes to be swapped.
21
22
23       dst       A  pointer  to the destination buffer where the swapped bytes
24                 will be written. If dst is the same as src the buffer will be
25                 swapped in place.
26
27
28       nbytes    Number  of  bytes  to be swapped, rounded down to the nearest
29                 half-word.
30
31

DESCRIPTION

33       The swab() function copies the bytes in the buffer pointed to by src to
34       the  buffer  pointer to by dst, swapping the order of adjacent bytes in
35       half-word pairs as the copy proceeds.  A  total  of  nbytes  bytes  are
36       copied, rounded down to the nearest half-word.
37

CONTEXT

39       The  swab() function can be called from user, interrupt, or kernel con‐
40       text.
41

SEE ALSO

43       Writing Device Drivers
44

NOTES

46       Since swab() operates byte-by-byte, it can be used on non-aligned  buf‐
47       fers.
48
49
50
51SunOS 5.11                        16 Jan 2006                         swab(9F)
Impressum