[BACK]Return to bitstr.c CVS log [TXT][DIR] Up to [Development] / linux-2.4-xfs / arch / x86_64 / lib

File: [Development] / linux-2.4-xfs / arch / x86_64 / lib / bitstr.c (download)

Revision 1.1, Wed Dec 31 00:54:49 2003 UTC (13 years, 9 months ago) by cattelan
Branch: MAIN
CVS Tags: HEAD

Initial Import 2.4.24pre2

#include <asm/bitops.h>

/* Find string of zero bits in a bitmap */ 
unsigned long 
find_next_zero_string(unsigned long *bitmap, long start, long nbits, int len)
{ 
	unsigned long n, end, i; 	

 again:
	n = find_next_zero_bit(bitmap, nbits, start);
	if (n == -1) 
		return -1;
	
	/* could test bitsliced, but it's hardly worth it */
	end = n+len;
	if (end >= nbits) 
		return -1; 
	for (i = n+1; i < end; i++) { 
		if (test_bit(i, bitmap)) {  
			start = i+1; 
			goto again; 
		} 
	}
	return n;
}