NCEPLIBS-bufr 11.7.1
pkb8.f
Go to the documentation of this file.
1C> @file
2C> @brief Encode an 8 byte integer value within an integer array.
3
4C> This subroutine encodes an 8-byte integer value within a specified
5C> number of bits of an integer array, starting at the bit
6C> immediately after a specified bit within the array.
7C>
8C> @author J. Woollen
9C> @date 2022-05-06
10C>
11C> @param[in] NVAL -- integer*8: Value to be encoded
12C> @param[in] NBITS -- integer: Number of bits of IBAY within
13C> which to encode NVAL
14C> @param[out] IBAY -- integer(*): Array containing encoded NVAL
15C> @param[in,out] IBIT -- integer: Bit pointer within IBAY
16C> - On input, IBIT points to the bit within
17C> IBAY after which to begin encoding NVAL.
18C> - On output, IBIT points to the last bit
19C> of IBAY which contains the encoded NVAL.
20C>
21C> @remarks
22C> - This subroutine is the logical inverse of subroutine up8().
23C> - This subroutine will not work properly if NBITS is less than 0 or
24C> greater than 64, as determined via an internal call to subroutine
25C> wrdlen().
26C>
27C> <b>Program history log:</b>
28C> | Date | Programmer | Comments |
29C> | -----|------------|----------|
30C> | 2022-05-06 | J. Woollen | Original author |
31C>
32!----------------------------------------------------------------------
33!----------------------------------------------------------------------
34
35 subroutine pkb8(nval,nbits,ibay,ibit)
36
37 common /hrdwrd/ nbytw,nbitw,iord(8)
38
39 integer(8) :: nval
40 integer(4) :: nbits,ibit,ibay(*)
41
42 integer(8) :: nval8
43 integer(4) :: nval4
44 integer(4) :: nvals(2)
45
46 equivalence(nval8,nvals)
47
48 if(nbits<0 ) call bort('bufrlib: pkb8 - nbits < zero !!!!!')
49 if(nbits>64) call bort('bufrlib: pkb8 - nbits > 64 !!!!!')
50
51 if(nbitw==32) then
52 nval8=nval
53 nval4=nvals(2); call pkb(nval4,max(nbits-nbitw,0),ibay,ibit)
54 nval4=nvals(1); call pkb(nval4,min(nbits,nbitw ),ibay,ibit)
55 else
56 call pkb(nval,nbits,ibay,ibit)
57 endif
58
59 end subroutine
60
61
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine pkb8(nval, nbits, ibay, ibit)
This subroutine encodes an 8-byte integer value within a specified number of bits of an integer array...
Definition: pkb8.f:36
subroutine pkb(NVAL, NBITS, IBAY, IBIT)
This subroutine encodes an integer value within a specified number of bits of an integer array,...
Definition: pkb.f:39