bitstring.c revision 499b34cea04a46823d003d4c0520c8b03e8513cb
/*
* Copyright (C) 1999-2001 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.
*/
/* $Id: bitstring.c,v 1.11 2001/01/09 21:55:55 bwelling Exp $ */
#include <config.h>
#include <stddef.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;
} else
tbitpos -= n;
} else
/*
* This is far from optimal...
*/
while (n > 0) {
else
sbitpos++;
tbitpos++;
n--;
}
}