NCEPLIBS-bufr  12.0.0
upb8.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Decode an 8-byte integer value from an integer array.
3 C>
4 C> @author J. Woollen @date 2022-05-06
5 
6 C> This subroutine decodes an 8-byte integer value from within a
7 C> specified 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 up8(), 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> This subroutine will not work properly if NBITS is less than 0 or
15 C> greater than 64, as determined via an internal call to subroutine
16 C> wrdlen().
17 C>
18 C> @param[in] IBAY - integer(*): Array containing encoded value.
19 C> @param[in] IBIT - integer: Bit within IBAY after which to begin
20 C> decoding NVAL.
21 C> @param[in] NBITS - integer: Number of bits to be decoded.
22 C> @param[out] NVAL - integer*8: Decoded value.
23 C>
24 C> @author J. Woollen @date 2022-05-06
25  subroutine upb8(nval,nbits,ibit,ibay)
26 
27  common /hrdwrd/ nbytw,nbitw,iord(8)
28 
29  integer(8) :: nval
30  integer(4) :: nbits,ibit,ibay(*)
31 
32  integer(4) :: nvals(2)
33  integer(8) :: nval8
34  equivalence(nval8,nvals)
35 
36 !----------------------------------------------------------------------
37 !----------------------------------------------------------------------
38 
39  if(nbits<0 ) call bort('BUFRLIB: UPB8 - nbits < zero !!!!!')
40  if(nbits>64) then
41  nval=0
42  return
43  endif
44 
45  jbit=ibit
46  nvals=0
47  call upb(nvals(2),max(nbits-nbitw,0),ibay,jbit)
48  call upb(nvals(1),min(nbitw,nbits ),ibay,jbit)
49  nval=nval8
50 
51  end subroutine
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
subroutine upb8(nval, nbits, ibit, ibay)
This subroutine decodes an 8-byte integer value from within a specified number of bits of an integer ...
Definition: upb8.f:26
subroutine upb(NVAL, NBITS, IBAY, IBIT)
This subroutine decodes an integer value from within a specified number of bits of an integer array,...
Definition: upb.f:28