3 <<swab>>---swap adjacent bytes
7 void swab(const void *<[in]>, void *<[out]>, ssize_t <[n]>);
10 void swab(<[in]>, <[out]>, <[n]>
16 This function copies <[n]> bytes from the memory region
17 pointed to by <[in]> to the memory region pointed to by
18 <[out]>, exchanging adjacent even and odd bytes.
21 <<swab>> requires no supporting OS subroutines.
27 _DEFUN (swab
, (b1
, b2
, length
),
32 const char *from
= b1
;
35 for (ptr
= 1; ptr
< length
; ptr
+= 2)
42 if (ptr
== length
) /* I.e., if length is odd, */
43 to
[ptr
-1] = 0; /* then pad with a NUL. */