Author(s): M. Metcalf, R. Matthews | Library: KERNLIB |
Submitter: | Submitted: 01.02.1982 |
Language: Fortran and CDC: COMPASS, IBM: Assembler | Revised: 20.06.1985 |
BITPOS locates and counts the 1-bits in the right-most NBITS bits in a word or in a full-word array, returning their positions. Bit numbering is right-to-left, bit number 0 being the least significant bit in the first full word, bit number NBPW being the least significant bit in the second full word etc., where NBPW is the number of bits per machine word; this numbering is compatible with BITPAK (M441).
Structure:
SUBROUTINE subprogram
User Entry Names: BITPOS
External Entry Names: URKBYT (Fortran only)
COMMON Block Names and Lengths: /SLATE/ 40
(Fortran only)
Usage:
CALL BITPOS(IWORDS,NBITS,IXV,NX)
Notes:
The Fortran version contains a symbolic constant whose value must be set equal to the number of bits in a word (default 32).
Examples:
DIMENSION IXV(9) IWORD = 1676 C 1676 in base 2 is 11010001100 CALL BITPOS(IWORD,9,IXV,NX)sets
NX = 3, IXV(1) = 2, IXV(2) = 3, IXV(3) = 7.