NCEPLIBS-w3emc  2.11.0
mova2i.f
Go to the documentation of this file.
1 C> @file
2 C> @brief This Function copies a bit string from a Character*1 variable
3 C> to an integer variable.
4 C> @author Stephen Gilbert @date 1998-12-15
5 
6 C> This Function copies a bit string from a Character*1 variable
7 C> to an integer variable. It is intended to replace the Fortran Intrinsic
8 C> Function ICHAR, which only supports 0 <= ICHAR(a) <= 127 on the
9 C> IBM SP. If "a" is greater than 127 in the collating sequence,
10 C> ICHAR(a) does not return the expected bit value when the -qhot
11 C> ( and therefore -qsmp) option is used when compiling.
12 C> This function can be used for all values 0 <= ICHAR(a) <= 255 and
13 C> will work with or without the -qhot compiler option.
14 C>
15 C> Program history log:
16 C> - Stephen Gilbert 1998-12-15
17 C> - Stephen Gilbert 2001-06-11 Added a step to fill an 8-byte character
18 C> array with the same value so that the f90 transfer function is more
19 C> predictable. All bytes will now contain the desired value.
20 C>
21 C> @param[in] a Character*1 variable that holds the bitstring to extract.
22 C> @return mova2i() Integer value of the bitstring in character a.
23 C>
24  Integer Function mova2i(a)
25 C
26  integer mold
27  character(len=1) a
28  character(len=1) ctemp(8)
29 
30  ctemp(1:8)=a
31 c mova2i=ishft(transfer(ctemp,mold),8-bit_size(mold))
32  mova2i=iand(transfer(ctemp,mold),255)
33 
34  return
35  end
integer function mova2i(a)
This Function copies a bit string from a Character*1 variable to an integer variable.
Definition: mova2i.f:25