ffsl.c (124482) | ffsl.c (124514) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/libkern/ffsl.c 124482 2004-01-13 16:02:20Z des $"); | 35__FBSDID("$FreeBSD: head/sys/libkern/ffsl.c 124514 2004-01-14 07:47:10Z des $"); |
36 37#include <sys/libkern.h> 38 39/* 40 * Find First Set bit 41 */ 42int 43ffsl(long mask) 44{ 45 int bit; 46 47 if (mask == 0) 48 return (0); 49 for (bit = 1; !(mask & 1); bit++) | 36 37#include <sys/libkern.h> 38 39/* 40 * Find First Set bit 41 */ 42int 43ffsl(long mask) 44{ 45 int bit; 46 47 if (mask == 0) 48 return (0); 49 for (bit = 1; !(mask & 1); bit++) |
50 (unsigned long)mask >>= 1; | 50 mask = (unsigned long)mask >> 1; |
51 return (bit); 52} | 51 return (bit); 52} |