# 2.11BSD#431 - /usr/src/lib/libc/pdp/gen/ffs.s

##### Functions

    _ffs              X

       1: /*
       2:  * Copyright (c) 1987 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  */
       6:
       7: #ifdef LIBC_SCCS
       8:         <@(#)ffs.s	1.2 (Berkeley) 1/8/87\0>
       9:         .even
      10: #endif LIBC_SCCS
      11:
      12: #include "DEFS.h"
      13:
      14: /*
      15:  * ffs(mask)
      16:  *	long	mask;
      17:  *
      18:  * Return index of lowest order bit set in mask (counting from the right
      19:  * starting at 1), or zero if mask is zero.  Ffs(m) is essentiallty
      20:  * log2(m)+1 with a 0 error return.
      21:  */
      22: ENTRY(ffs)
      23:         clr     r0              / cnt:r0 = 0
      24:         mov     4(sp),r1        / if ((imask = loint(mask)) != 0)
      25:         bne     1f
      26:         mov     2(sp),r1        / if ((imask = hiint(mask)) == 0)
      27:         beq     2f
      28:         mov     $16.,r0         / else  cnt = 16
      29: 1:
      30:         inc     r0              / do { cnt++
      31:         asr     r1              / 	imask >>= 1
      32:         bcc     1b              / } while (!wasodd(imask))
      33: 2:
      34:         rts     pc              / return(cnt:r0)

#### Defined functions

_ffs defined in line 22; used 8 times

- in /usr/src/new/jove/jove.c line 249
- in /usr/src/sys/pdpif/if_en.c line 285
- in /usr/src/sys/sys/kern_exec.c line 408
- in /usr/src/sys/sys/kern_sig.c line 410
- in /usr/src/sys/sys/kern_sig2.c line 374
- in /usr/src/sys/sys/sys_generic.c line 479
- in /usr/src/sys/sys/ufs_disksubr.c line 125
- in /usr/src/ucb/tn3270/tn3270.c line 571

Last modified: 1987-02-05 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1033 |