bitset.c revision fb2f18f820d90b001aea4fb27dd654bc1263c440
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
/*
* Initialize a bitset_t.
* After bitset_init(), the bitset will be zero sized.
*/
void
bitset_init(bitset_t *b)
{
}
/*
* Uninitialize a bitset_t.
* This will free the bitset's data, leaving it zero sized.
*/
void
bitset_fini(bitset_t *b)
{
if (b->bs_words > 0)
}
/*
* Resize a bitset to where it can hold sz number of bits.
* This can either grow or shrink the bitset holding capacity.
* In the case of shrinkage, elements that reside outside the new
* holding capacity of the bitset are lost.
*/
void
{
return; /* already properly sized */
/*
* Allocate the new ulong_t array, and copy the old one.
*/
if (nwords > 0) {
} else {
}
/* swap out the old ulong_t array for new one */
/* free up the old array */
}
/*
* Returns the current holding capacity of the bitset
*/
{
}
/*
* Add and delete bits in the bitset.
*
* Adding a bit that is already set, and clearing a bit that's already clear
* is legal.
*
* Adding or deleting an element that falls outside the bitset's current
* holding capacity is illegal.
*/
void
{
}
void
{
}
/*
* Return non-zero if the bit is present in the set
*/
int
{
}
/*
* Return non-zero if the bitset is empty
*/
int
{
int i;
for (i = 0; i < b->bs_words; i++)
if (b->bs_set[i] != 0)
return (0);
return (1);
}
/*
* Find the first set bit in the bitset
* Return -1 if no bit was found
*/
bitset_find(bitset_t *b)
{
uint_t i;
for (i = 0; i < b->bs_words; i++) {
break;
}
}
return (elt);
}