Author(s): M. Metcalf, R. Matthews | Library: KERNLIB |
Submitter: | Submitted: 01.02.1982 |
Language: Fortran or Assembler | Revised: 20.06.1985 |
UBITS locates and counts the 1-bits in the right-most NBITS bits in a word or full-word array, returning their positions. Bit numbering is right to left, bit number 1 being the least significant bit in the first full word, bit number NBPW+1 being the least significant bit in the second full word, where NBPW is the number of bits per machine word.
Structure:
SUBROUTINE subprogram
User Entry Names: UBITS
External References: UPKBYT
(Fortran version only)
Usage:
CALL UBITS(IWORDS,NBITS,IXV,NX)
Examples:
DIMENSION IXV(9) IWORD=1676 C 1676 in base 2 is 11010001100 CALL UBITS(IWORD,9,IXV,NX)sets
NX = 3, IXV(1) = 3, IXV(2) = 4, IXV(3) = 8.