ELinks 0.16.1.1
bitfield Struct Reference

A vector of bits. More...

#include <bitfield.h>

Data Fields

unsigned int bitsize
 Number of bits in the bitfield.
unsigned char bits [1]
 Strawberry bitfields forever.

(Note that these are not member symbols.)

#define foreach_bitfield_set(bit, bitfield)
#define foreachback_bitfield_set(bit, bitfield)
#define foreach_bitfield_cleared(bit, bitfield)
static struct bitfieldinit_bitfield (size_t bits)
 Allocate a bitfield containing bits number of bits.
static void copy_bitfield (struct bitfield *bitfield, const char *bits, unsigned int bytesize)
 Update bitfield with the bytesize bytes from the bit string in bits.
static int test_bitfield_bit (struct bitfield *bitfield, unsigned int bit)
 Test whether bit is set in the bitfield.
static void set_bitfield_bit (struct bitfield *bitfield, unsigned int bit)
 Set bit in the bitfield.
static void clear_bitfield_bit (struct bitfield *bitfield, unsigned int bit)
 Unset bit in the bitfield.
static unsigned int get_bitfield_set_count (struct bitfield *bitfield)
 Count the set bits in bitfield.
static unsigned int get_bitfield_cleared_count (struct bitfield *bitfield)
 Count the unset bits in bitfield.
static unsigned int bitfield_is_set (struct bitfield *bitfield)
 Check whether all bits of bitfield are set.
static unsigned int bitfield_is_cleared (struct bitfield *bitfield)
 Check whether all bits of bitfield are unset.

Detailed Description

A vector of bits.

The size is fixed at initialization time.

◆ bitfield_is_cleared()

unsigned int bitfield_is_cleared ( struct bitfield * bitfield)
related

Check whether all bits of bitfield are unset.

◆ bitfield_is_set()

unsigned int bitfield_is_set ( struct bitfield * bitfield)
related

Check whether all bits of bitfield are set.

◆ clear_bitfield_bit()

void clear_bitfield_bit ( struct bitfield * bitfield,
unsigned int bit )
related

Unset bit in the bitfield.

◆ copy_bitfield()

void copy_bitfield ( struct bitfield * bitfield,
const char * bits,
unsigned int bytesize )
related

Update bitfield with the bytesize bytes from the bit string in bits.

◆ foreach_bitfield_cleared

#define foreach_bitfield_cleared ( bit,
bitfield )
related
Value:
for ((bit) = 0; (bit) < (bitfield)->bitsize; (bit)++) \
A vector of bits.
Definition bitfield.h:14
static int test_bitfield_bit(struct bitfield *bitfield, unsigned int bit)
Test whether bit is set in the bitfield.
Definition bitfield.h:70

◆ foreach_bitfield_set

#define foreach_bitfield_set ( bit,
bitfield )
related
Value:
for ((bit) = 0; (bit) < (bitfield)->bitsize; (bit)++) \

◆ foreachback_bitfield_set

#define foreachback_bitfield_set ( bit,
bitfield )
related
Value:
for ((bit) = (bitfield)->bitsize; (bit) > 0;) \
unsigned int bitsize
Number of bits in the bitfield.
Definition bitfield.h:15

◆ get_bitfield_cleared_count()

unsigned int get_bitfield_cleared_count ( struct bitfield * bitfield)
related

Count the unset bits in bitfield.

◆ get_bitfield_set_count()

unsigned int get_bitfield_set_count ( struct bitfield * bitfield)
related

Count the set bits in bitfield.

◆ init_bitfield()

struct bitfield * init_bitfield ( size_t bits)
related

Allocate a bitfield containing bits number of bits.

◆ set_bitfield_bit()

void set_bitfield_bit ( struct bitfield * bitfield,
unsigned int bit )
related

Set bit in the bitfield.

◆ test_bitfield_bit()

int test_bitfield_bit ( struct bitfield * bitfield,
unsigned int bit )
related

Test whether bit is set in the bitfield.

Field Documentation

◆ bits

unsigned char bitfield::bits[1]

Strawberry bitfields forever.

◆ bitsize

unsigned int bitfield::bitsize

Number of bits in the bitfield.


The documentation for this struct was generated from the following file: