en

swap.3


Introduction to Library Functions                         SWAP(3)

NAME
     swap - integral representation conversion routines

SYNOPSIS
     #include <swap.h>

     int swapop(const void* internal, const void*  external,  int
     width);  int_max  swapget(int  op,  const  void*  from,  int
     width); void* swapput(int op, void* to, int  width,  int_max
     value);  void*  swapmem(int  op, const void* from, void* to,
     size_t n);

DESCRIPTION
     These routines convert integral constants  between  internal
     and  external  representations.   They  are  used  to handle
     binary data generated by foreign programs.  New binary  data
     representations  should  use the compact canonical form pro-
     vided by the sfio(3) routines sfputu and sgetu.

     swapop returns the swap operation required  to  convert  the
     width byte integer external to the width byte integer inter-
     nal.  The swap operation is a bit mask:

     0    No swapping necessary.

     1    Swap byte 0 with byte 1.

     2    Swap bytes 0 and 1 with bytes 2 and 3.

     4    Swap bytes 0-3 with bytes 4-7, and so on.  The  largest
          native integral type is defined by the macro int_max in
          the header <int.h> described in int(3).

     swapget returns the width byte integer in the  buffer  from,
     swapped according to op.

     swapput copies the width byte integer value into the  buffer
     to, swapped according to op.  to is returned.

     swapmem swaps n bytes from the buffer from to the buffer  to
     according to op.  to and from may be the same.

SEE ALSO
     int(3)

SunOS 5.10                Last change:                          1


Generated by GNU enscript 1.6.4.

Tags:
Created by admin on 2009/10/26 12:15
Last modified by admin on 2009/10/26 12:15

Collectives

Project ksh93-integration Pages


XWiki Enterprise 2.7.1.34853 - Documentation