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