NCEPLIBS-bufr  12.0.0
irev.F File Reference

Return a copy of an input integer word with the bytes reversed. More...

Go to the source code of this file.

Functions/Subroutines

function irev (N)
 This function will, when the local machine is "little-endian" (i.e., when it uses a right to left scheme for numbering the bytes within a machine word), return a copy of an input integer word with the bytes reversed. More...
 

Detailed Description

Return a copy of an input integer word with the bytes reversed.

Author
Woollen
Date
1994-01-06

Definition in file irev.F.

Function/Subroutine Documentation

◆ irev()

function irev (   N)

This function will, when the local machine is "little-endian" (i.e., when it uses a right to left scheme for numbering the bytes within a machine word), return a copy of an input integer word with the bytes reversed.

Although, by definition (within WMO Manual 306), a BUFR message is a stream of individual octets (i.e., bytes) that is independent of any particular machine representation, the BUFR archive library software often needs to interpret all or parts of two or more adjacent bytes in order to construct an integer word. By default, the software uses the "big-endian" (left to right) scheme for numbering bytes. By reversing the bytes, irev() allows the integer word to be properly read or written (depending on whether input or output operations, respectively, are being performed) on "little-endian" machines. If the local machine is "big-endian", irev() simply returns a copy of the same integer that was input.

Parameters
[in]N- integer: integer word with bytes ordered according to the "big-endian" numbering scheme
Returns
- integer: integer word with bytes ordered according to the numbering scheme of the local machine (either "big-endian" or "little-endian"; if "big-endian" then this is just a direct copy of N).
Author
Woollen
Date
1994-01-06

Definition at line 32 of file irev.F.

Referenced by ipkm(), iupm(), pkb(), pkc(), and upbb().