[net.bugs.4bsd] Bug in ffs

donn@utah-cs.UUCP (Donn Seeley) (09/18/84)

Actually the bug is undoubtedly in the documentation...  Under the
manual section 'bstring' we read:

	A return value of -1 indicates that the value passed is zero.

But a look at the source (and the kernel asm.sed) shows that 0 is
returned for zero.  I assume that the code is right and the manual page
is wrong.  Although my knowledge of Sun assembler is close to zip, it
would appear that the same inconsistency exists in the Sun 1.1
distribution.

Unless ffs() returns 0 for zero, you lose the only good reason to
number the bits from 1 instead of from 0...  (Growl.)

Donn Seeley    University of Utah CS Dept    donn@utah-cs.arpa
40 46' 6"N 111 50' 34"W    (801) 581-5668    decvax!utah-cs!donn

gnu@sun.uucp (John Gilmore) (09/19/84)

Donn is right; both in the Vax and Sun libc routines, the result is
0 if the argument is 0.  Unless something is terribly wrong, the
documentation is terribly wrong.