SpiNNFrontEndCommon 7.3.1
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
Data Structures | Functions
bit_set.h File Reference

Sets of bits. More...

#include <bit_field.h>
#include <stdint.h>
#include <malloc_extras.h>
#include "../common/constants.h"
#include <debug.h>

Go to the source code of this file.

Data Structures

struct  bit_set_t
 wrapper over bitfield More...
 

Functions

bool bit_set_clear (bit_set_t *b)
 Empty a bitset entirely.
 
static bool bit_set_init (bit_set_t *b, unsigned int length)
 Create a new bitset.
 
static void bit_set_delete (bit_set_t *b)
 Destroy a bitset.
 
static bool bit_set_add (bit_set_t *b, unsigned int i)
 Add an element to a bitset.
 
static bool bit_set_contains (bit_set_t *b, unsigned int i)
 Test if an element is in a bitset.
 
static bool bit_set_remove (bit_set_t *b, unsigned int i)
 Remove an element from a bitset.
 
static void print_bit_field_entry_v2 (uint32_t e, int offset)
 This function prints out an individual word of a bit_field, as a sequence of ones and zeros.
 
void print_bit_field_bits_v2 (bit_field_t b, size_t s)
 This function prints out an entire bit_field, as a sequence of ones and zeros.
 
void print_bit_set_bits (bit_field_t b, int s)
 This function prints out an entire bit_field, as a sequence of ones and zeros.
 
void print_bit_set (bit_set_t b)
 prints a bit set
 

Detailed Description

Sets of bits.

Definition in file bit_set.h.


Data Structure Documentation

◆ bit_set_t

struct bit_set_t

wrapper over bitfield

Definition at line 33 of file bit_set.h.

Data Fields
unsigned int count Keep track of members.
unsigned int n_words Number of words in _data.
unsigned int n_elements Number of elements which may be in the set.

Function Documentation

◆ bit_set_clear()

bool bit_set_clear ( bit_set_t b)

Empty a bitset entirely.

Parameters
[in]bthe bit set to clear bits
Returns
bool saying successfully cleared bit field

Definition at line 50 of file bit_set.h.

◆ bit_set_init()

static bool bit_set_init ( bit_set_t b,
unsigned int  length 
)
inlinestatic

Create a new bitset.

Parameters
[in]bthe bitset to create
[in]lengththe length of bits to make
Returns
whether the bitset was created

Definition at line 65 of file bit_set.h.

◆ bit_set_delete()

static void bit_set_delete ( bit_set_t b)
inlinestatic

Destroy a bitset.

Parameters
[in]bthe bitset to delete

Definition at line 89 of file bit_set.h.

◆ bit_set_add()

static bool bit_set_add ( bit_set_t b,
unsigned int  i 
)
inlinestatic

Add an element to a bitset.

Parameters
[in]bthe bitset to add to
[in]ithe bit to set / add
Returns
whether the bit is added successfully

Definition at line 100 of file bit_set.h.

◆ bit_set_contains()

static bool bit_set_contains ( bit_set_t b,
unsigned int  i 
)
inlinestatic

Test if an element is in a bitset.

Parameters
[in]bthe bitset to check
[in]ithe bit to check is set /added
Returns
whether the bit is set/added in the bitfield

Definition at line 121 of file bit_set.h.

◆ bit_set_remove()

static bool bit_set_remove ( bit_set_t b,
unsigned int  i 
)
inlinestatic

Remove an element from a bitset.

Parameters
[in]bthe bitset to remove/unset the bit from
[in]ithe bit to unset
Returns
whether unset succeeded

Definition at line 136 of file bit_set.h.

◆ print_bit_field_entry_v2()

static void print_bit_field_entry_v2 ( uint32_t  e,
int  offset 
)
inlinestatic

This function prints out an individual word of a bit_field, as a sequence of ones and zeros.

Parameters
[in]eThe word of a bit_field to be printed.
[in]offsetthe offset in id

Definition at line 156 of file bit_set.h.

◆ print_bit_field_bits_v2()

void print_bit_field_bits_v2 ( bit_field_t  b,
size_t  s 
)

This function prints out an entire bit_field, as a sequence of ones and zeros.

Parameters
[in]bThe sequence of words representing a bit_field.
[in]sThe size of the bit_field.

Definition at line 167 of file bit_set.h.

◆ print_bit_set_bits()

void print_bit_set_bits ( bit_field_t  b,
int  s 
)

This function prints out an entire bit_field, as a sequence of ones and zeros.

Parameters
[in]bThe sequence of words representing a bit_field.
[in]sThe size of the bit_field.

Definition at line 177 of file bit_set.h.

◆ print_bit_set()

void print_bit_set ( bit_set_t  b)

prints a bit set

Parameters
[in]bthe bitset to print

Definition at line 185 of file bit_set.h.