/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Operations on bitmaps of arbitrary size
* A bitmap is a vector of 1 or more ulongs.
* The user of the package is responsible for range checks and keeping
* track of sizes.
*/
/*
* Return index of first available bit in denoted bitmap, or -1 for
* failure. Size is the cardinality of the bitmap; that is, the
* number of bits.
* No side-effects. In particular, does not update bitmap.
* Caller is responsible for range checks.
*/
{
/*
* Look for a word with a bit off.
* Subtract one from nbits because we're converting it to a
* a range of indices.
*/
nbits -= 1;
break;
/*
* Found a word with a bit off. Now find the bit in the word.
*/
bit = 1;
}
}
}
return (-1);
}
/*
* Find highest order bit that is on, and is within or below
* the word specified by wx.
*/
int
{
wx--;
if (wx < 0) {
return (-1);
}
}
}
/*
* Search the bitmap for a consecutive pattern of 1's.
* Search starts at position pos1.
* Returns 1 on success and 0 on failure.
* Side effects.
* Returns indices to the first bit (pos1)
* and one past the last bit (pos2) in the pattern.
*/
int
{
break;
return (0);
break;
return (1);
}
/*
* return the parity of the supplied long
*
* this works by successively partitioning the argument in half, and
* setting the parity of the result to the parity of the 2 halfs, until
* only one bit is left
*/
int
{
#ifdef _LP64
i ^= i >> 32;
#endif
i ^= i >> 16;
i ^= i >> 8;
i ^= i >> 4;
i ^= i >> 2;
i ^= i >> 1;
return (i & 0x01);
}
/*
* get the lowest bit in the range of 'start' and 'stop', inclusive.
* I.e., if caller calls bt_getlowbit(map, X, Y), any value between X and Y,
* including X and Y can be returned.
* Neither start nor stop is required to align with word boundaries.
* If a bit is set in the range, the bit position is returned; otherwise,
* a -1 is returned.
*/
int
{
return (-1);
}
/*
* The range between 'start' and 'stop' can be very large, and the
* '1' bits in this range can be sparse.
* For performance reason, the underlying implementation operates
* on words, not on bits.
*/
if (partial_start) {
/*
* Since the start is not aligned on word boundary, we
* need to patch the unwanted low order bits with 0's before
* operating on the first bitmap word.
*/
}
/*
* Locate a word from the map array with one of the bits set.
*/
}
/*
* The end of range has similar problems if it is not aligned.
* Taking care of the end which is not aligned.
*/
/*
* Take care the partial word by patch the high order
* bits with 0's. Here we dealing with the case that
* the last word of the bitmap is not aligned.
*/
}
/*
* Examine the word.
*/
if (word == 0) {
return (-1);
} else {
}
}
/*
* Copy the bitmap.
*/
void
{
ulong_t i;
for (i = 0; i < size; i++)
}