swap_lw_bytes man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

swap_lw_bytes(9r)					     swap_lw_bytes(9r)

NAME
       swap_lw_bytes,  swap_word_bytes,	 swap_words  -	General: Perform byte-
       swapping operations

SYNOPSIS
       unsigned int swap_lw_bytes(
	       unsigned int buffer ); unsigned int swap_word_bytes(
	       unsigned int buffer ); unsigned int swap_words(
	       unsigned int buffer );

ARGUMENTS
       Specifies a 32-bit (4 bytes) quantity.

DESCRIPTION
       The  swap_lw_bytes  interface  performs	a  longword  byte  swap.   The
       swap_word_bytes	 interface  performs  a	 short	word  byte  swap.  The
       swap_words interface performs a word byte swap. Many  computer  vendors
       support	devices	 that use a big endian model of byte ordering. Because
       Digital devices support the little endian model of byte ordering, there
       is  a  need for these byte-swapping interfaces. In addition, some buses
       (for example, the VMEbus) can have specific or  implied	byte  ordering
       that may require the use of these interfaces.

       Given  that  a longword is equal to 4 bytes; a short word is equal to 2
       bytes; and 1 byte is equal to 8 bits, these interfaces  swap  bytes  as
       follows:	 The  swap_lw_bytes interface takes the 32-bit quantity speciā€
       fied by the buffer argument and swaps all 4 bytes.  The swap_word_bytes
       interface  takes	 the  32-bit quantity specified by the buffer argument
       and swaps the individual bytes that make up each	 word  of  the	32-bit
       quantity.  The swap_words interface takes the 32-bit quantity specified
       by the buffer argument and swaps the two 16-bit words.

       The following illustration compares  the	 byte  swapping	 performed  by
       these interfaces.

			 31		  0
			  +---+---+---+---+ Starting value:    | a | b | c | d
       |
			  +---+---+---+---+

			  Long word byte swap
			  (swap_lw_bytes)

			 31		  0
			  +---+---+---+---+ Ending value:      | d | c | b | a
       |
			  +-------+---+---+

			  Short word byte swap
			  (swap_word_bytes)

			 31		  0
			  +---+---+---+---+ Ending value:      | b | a | d | c
       |
			  +---+---+---+---+

			 31		  0
			  +---+---+---+---+ Starting value:    |   ab  |    cd
       |
			  +---+---+---+---+

			  Word byte swap
			  (swap_words)

			 31		  0
			  +---+---+---+---+  Ending  value:	 |  cd	 |  ab
       |
			  +---+---+---+---+

RETURN VALUES
       Upon successful completion, these interfaces return the swapped bytes.

							     swap_lw_bytes(9r)
[top]

List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net