Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Kernel Functions for Driversswab(9F)


NAME

 swab - swap bytes in 16-bit halfwords

SYNOPSIS

 
#include <sys/sunddi.h>
void swab(void *src, void *dst, size_t nbytes);

INTERFACE LEVEL

 

Architecture independent level 1 (DDI/DKI).

PARAMETERS

 
src
A pointer to the buffer containing the bytes to be swapped.
dst
A pointer to the destination buffer where the swapped bytes will be written. If dst is the same as src the buffer will be swapped in place.
nbytes
Number of bytes to be swapped, rounded down to the nearest half-word.

DESCRIPTION

 

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

CONTEXT

 

swab() can be called from user or interrupt context.

SEE ALSO

 

Writing Device Drivers

NOTES

 

Since swab() operates byte-by-byte, it can be used on non-aligned buffers.


SunOS 5.9Go To TopLast Changed 1 Feb 1991

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.