3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS FUNCTION WILL, WHEN THE LOCAL MACHINE IS "LITTLE-
9 C ENDIAN" (I.E., USES A RIGHT TO LEFT SCHEME FOR NUMBERING THE BYTES
10 C WITHIN A MACHINE WORD), RETURN A COPY OF AN INPUT INTEGER WORD WITH
11 C THE BYTES REVERSED. ALTHOUGH, BY DEFINITION (WITHIN WMO MANUAL
12 C 306), A BUFR MESSAGE IS A STREAM OF INDIVIDUAL OCTETS (I.E., BYTES)
13 C THAT IS INDEPENDENT OF ANY PARTICULAR MACHINE REPRESENTATION, THE
14 C BUFR ARCHIVE LIBRARY SOFTWARE OFTEN NEEDS TO INTERPRET ALL OR PARTS
15 C OF TWO OR MORE ADJACENT BYTES IN ORDER TO CONSTRUCT AN INTEGER
16 C WORD. BY DEFAULT, THE SOFTWARE USES THE "BIG-ENDIAN" (LEFT TO
17 C RIGHT) SCHEME FOR NUMBERING BYTES. BY REVERSING THE BYTES, IREV
18 C ALLOWS THE INTEGER WORD TO BE PROPERLY READ OR WRITTEN (DEPENDING
19 C ON WHETHER INPUT OR OUTPUT OPERATIONS, RESPECTIVELY, ARE BEING
20 C PERFORMED) ON LITTLE-ENDIAN MACHINES. IF THE LOCAL MACHINE IS
21 C BIG-ENDIAN, IREV SIMPLY RETURNS A COPY OF THE SAME INTEGER THAT WAS
24 C PROGRAM HISTORY LOG:
25 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
26 C 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
27 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
29 C 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
31 C 2007-01-19 J. ATOR -- BIG-ENDIAN VS. LITTLE-ENDIAN IS NOW
32 C DETERMINED AT COMPILE TIME AND CONFIGURED
33 C WITHIN BUFRLIB VIA CONDITIONAL COMPILATION
37 C INPUT ARGUMENT LIST:
38 C N - INTEGER: INTEGER WORD WITH BYTES ORDERED ACCORDING TO
39 C THE "BIG-ENDIAN" NUMBERING SCHEME
41 C OUTPUT ARGUMENT LIST:
42 C IREV - INTEGER: INTEGER WORD WITH BYTES ORDERED ACCORDING TO
43 C THE NUMBERING SCHEME OF THE LOCAL MACHINE (EITHER
44 C "BIG-ENDIAN" OR "LITTLE-ENDIAN", IF "BIG-ENDIAN THEN
45 C THIS IS JUST A DIRECT COPY OF N)
48 C THIS ROUTINE CALLS: None
49 C THIS ROUTINE IS CALLED BY: IPKM IUPM PKB PKC
51 C Normally not called by any application
55 C LANGUAGE: FORTRAN 77
56 C MACHINE: PORTABLE TO ALL PLATFORMS
60 COMMON /HRDWRD
/ NBYTW
,NBITW
,IORD
(8)
66 C----------------------------------------------------------------------
67 C----------------------------------------------------------------------
74 DINT
(I
:I
) = CINT
(IORD
(I
):IORD
(I
))