152716Sbostic/*- 2*61146Sbostic * Copyright (c) 1991, 1993 3*61146Sbostic * The Regents of the University of California. All rights reserved. 452716Sbostic * 552716Sbostic * This code is derived from software contributed to Berkeley by 652716Sbostic * Ralph Campbell. 752716Sbostic * 852716Sbostic * %sccs.include.redist.c% 952716Sbostic */ 1052716Sbostic 1155708Sralph#include <machine/machAsmDefs.h> 1252737Sbostic 1352716Sbostic#if defined(LIBC_SCCS) && !defined(lint) 14*61146Sbostic ASMSTR("@(#)ffs.s 8.1 (Berkeley) 06/04/93") 1552716Sbostic#endif /* LIBC_SCCS and not lint */ 1652716Sbostic 1752716Sbostic/* bit = ffs(value) */ 1852716Sbostic 1952716SbosticLEAF(ffs) 2052716Sbostic move v0, zero 2152716Sbostic beq a0, zero, done 2252716Sbostic1: 2352716Sbostic and v1, a0, 1 # bit set? 2452716Sbostic addu v0, v0, 1 2552716Sbostic srl a0, a0, 1 2652716Sbostic beq v1, zero, 1b # no, continue 2752716Sbosticdone: 2852716Sbostic j ra 2952716SbosticEND(ffs) 30