NCEPLIBS-bufr
11.7.1
irev.F
Go to the documentation of this file.
1
C> @file
2
C> @author WOOLLEN @date 1994-01-06
3
4
C> THIS FUNCTION WILL, WHEN THE LOCAL MACHINE IS "LITTLE-
5
C> ENDIAN" (I.E., USES A RIGHT TO LEFT SCHEME FOR NUMBERING THE BYTES
6
C> WITHIN A MACHINE WORD), RETURN A COPY OF AN INPUT INTEGER WORD WITH
7
C> THE BYTES REVERSED. ALTHOUGH, BY DEFINITION (WITHIN WMO MANUAL
8
C> 306), A BUFR MESSAGE IS A STREAM OF INDIVIDUAL OCTETS (I.E., BYTES)
9
C> THAT IS INDEPENDENT OF ANY PARTICULAR MACHINE REPRESENTATION, THE
10
C> BUFR ARCHIVE LIBRARY SOFTWARE OFTEN NEEDS TO INTERPRET ALL OR PARTS
11
C> OF TWO OR MORE ADJACENT BYTES IN ORDER TO CONSTRUCT AN INTEGER
12
C> WORD. BY DEFAULT, THE SOFTWARE USES THE "BIG-ENDIAN" (LEFT TO
13
C> RIGHT) SCHEME FOR NUMBERING BYTES. BY REVERSING THE BYTES, IREV
14
C> ALLOWS THE INTEGER WORD TO BE PROPERLY READ OR WRITTEN (DEPENDING
15
C> ON WHETHER INPUT OR OUTPUT OPERATIONS, RESPECTIVELY, ARE BEING
16
C> PERFORMED) ON LITTLE-ENDIAN MACHINES. IF THE LOCAL MACHINE IS
17
C> BIG-ENDIAN, IREV SIMPLY RETURNS A COPY OF THE SAME INTEGER THAT WAS
18
C> INPUT.
19
C>
20
C> PROGRAM HISTORY LOG:
21
C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
22
C> 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
23
C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
24
C> INTERDEPENDENCIES
25
C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
26
C> DOCUMENTATION
27
C> 2007-01-19 J. ATOR -- BIG-ENDIAN VS. LITTLE-ENDIAN IS NOW
28
C> DETERMINED AT COMPILE TIME AND CONFIGURED
29
C> WITHIN BUFRLIB VIA CONDITIONAL COMPILATION
30
C> DIRECTIVES
31
C>
32
C> USAGE: IREV (N)
33
C> INPUT ARGUMENT LIST:
34
C> N - INTEGER: INTEGER WORD WITH BYTES ORDERED ACCORDING TO
35
C> THE "BIG-ENDIAN" NUMBERING SCHEME
36
C>
37
C> OUTPUT ARGUMENT LIST:
38
C> IREV - INTEGER: INTEGER WORD WITH BYTES ORDERED ACCORDING TO
39
C> THE NUMBERING SCHEME OF THE LOCAL MACHINE (EITHER
40
C> "BIG-ENDIAN" OR "LITTLE-ENDIAN", IF "BIG-ENDIAN THEN
41
C> THIS IS JUST A DIRECT COPY OF N)
42
C>
43
C> REMARKS:
44
C> THIS ROUTINE CALLS: None
45
C> THIS ROUTINE IS CALLED BY: IPKM IUPM PKB PKC
46
C> UPBB
47
C> Normally not called by any application
48
C> programs.
49
C>
50
FUNCTION
irev
(N)
51
52
53
54
COMMON
/hrdwrd/ nbytw,nbitw,iord(8)
55
56
CHARACTER*8
cint,dint
57
equivalence(cint,int)
58
equivalence(dint,jnt)
59
60
C----------------------------------------------------------------------
61
C----------------------------------------------------------------------
62
63
#ifdef BIG_ENDIAN
64
irev
= n
65
#else
66
int = n
67
DO
i=1,nbytw
68
dint(i:i) = cint(iord(i):iord(i))
69
ENDDO
70
irev
= jnt
71
#endif
72
73
RETURN
74
END
irev
function irev(N)
THIS FUNCTION WILL, WHEN THE LOCAL MACHINE IS "LITTLE- ENDIAN" (I.E., USES A RIGHT TO LEFT SCHEME ...
Definition:
irev.F:51
nceplibs-bufr
src
irev.F
Generated by
1.9.4