NCEPLIBS-bufr  12.0.1
upbb.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Decode an integer value from an integer array.
3 C>
4 C> @author J. Woollen @date 1994-01-06
5 
6 C> This subroutine decodes an integer value from within a specified
7 C> number of bits of an integer array, starting at the bit
8 C> immediately after a specified bit within the array.
9 C>
10 C> It is similar to subroutine upb(), except that here IBIT is
11 C> only an input argument, and the overall order of the arguments
12 C> is different.
13 C>
14 C> @param[in] IBAY -- integer(*): Array containing encoded value
15 C> @param[in] IBIT -- integer: Bit within IBAY after which to begin
16 C> decoding NVAL
17 C> @param[in] NBITS -- integer: Number of bits to be decoded
18 C> @param[out] NVAL -- integer: Decoded value
19 C>
20 C> @author J. Woollen @date 1994-01-06
21  SUBROUTINE upbb(NVAL,NBITS,IBIT,IBAY)
22 
23  COMMON /hrdwrd/ nbytw,nbitw,iord(8)
24 
25  dimension ibay(*)
26 
27 C----------------------------------------------------------------------
28 C----------------------------------------------------------------------
29 
30 C IF NBITS=0, THEN JUST SET NVAL=0 AND RETURN
31 C -------------------------------------------
32 
33  IF(nbits.EQ.0)THEN
34  nval=0
35  GOTO 100
36  ENDIF
37 
38  nwd = ibit/nbitw + 1
39  nbt = mod(ibit,nbitw)
40  int = ishft(irev(ibay(nwd)),nbt)
41  int = ishft(int,nbits-nbitw)
42  lbt = nbt+nbits
43  IF(lbt.GT.nbitw) THEN
44  jnt = irev(ibay(nwd+1))
45  int = ior(int,ishft(jnt,lbt-2*nbitw))
46  ENDIF
47  nval = int
48 
49 C EXIT
50 C ----
51 
52 100 RETURN
53  END
function irev(N)
This function will, when the local machine is "little-endian" (i.e., when it uses a right to left sch...
Definition: irev.F:33
subroutine upbb(NVAL, NBITS, IBIT, IBAY)
This subroutine decodes an integer value from within a specified number of bits of an integer array,...
Definition: upbb.f:22