Annotation of 42BSD/ingres/source/gutil/bitpos.c, revision 1.1

1.1     ! root        1: # include      <sccs.h>
        !             2: 
        !             3: SCCSID(@(#)bitpos.c    7.1     2/5/81)
        !             4: 
        !             5: /*
        !             6: **  FIND HIGH ORDER BIT POSITION
        !             7: **
        !             8: **     The position of the highest ordered one bit in `wd' is
        !             9: **     found and returned.  Bits are numbered 0 -> 15, from
        !            10: **     right (low-order) to left (high-order) in word.
        !            11: */
        !            12: 
        !            13: bitpos(wd)
        !            14: register int   wd;
        !            15: {
        !            16:        register int    i, j;
        !            17:        register int    pos;
        !            18: 
        !            19:        pos = -1;
        !            20: 
        !            21:        for (i = 1, j = 0; wd; i <<= 1, j++)
        !            22:        {
        !            23:                if (wd & i)
        !            24:                {
        !            25:                        pos = j;
        !            26:                        wd &= ~i;
        !            27:                }
        !            28:        }
        !            29: 
        !            30:        return (pos);
        !            31: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.