bitstring.c revision 1819606910e5216e4adba6e0d32fd6e62dec3c97
/*
* Copyright (C) 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <stddef.h>
#include <isc/assertions.h>
#include <isc/bitstring.h>
#define DIV8(x) ((x) >> 3)
#define MOD8(x) ((x) & 0x00000007U)
#define VALID_BITSTRING(b) ((b) != NULL && \
(b)->magic == BITSTRING_MAGIC)
void
{
/*
* Make 'bitstring' refer to the bitstring of 'size' bits starting
* at 'data'. 'length' bits of the bitstring are valid. If 'lsb0'
* is set then, bit 0 refers to the least significant bit of the
* bitstring. Otherwise bit 0 is the most significant bit.
*/
}
void
/*
* Invalidate 'bitstring'.
*/
}
void
unsigned int n)
{
unsigned int tlast;
/*
* Starting at bit 'sbitpos', copy 'n' bits from 'source' to
* the 'n' bits of 'target' starting at 'tbitpos'.
*/
sbitpos -= n - 1;
} else
tbitpos -= n - 1;
} else
/*
* This is far from optimal...
*/
while (n > 0) {
else
sbitpos++;
tbitpos++;
n--;
}
}