Loading...
Searching...
No Matches
fixed_bitset.h File Reference
#include "pico.h"

Go to the source code of this file.

Data Structures

struct  fixed_bitset_t
 Base type for a fixed-size bitset. More...

Macros

#define fixed_bitset_type(N)
 Macro used to define a fixed-size bitset of a given size.
#define fixed_bitset_sizeof_for(N)
#define fixed_bitset_with_fill(type, N, fill)
 Macro used to create a bitset with all bits set to a value.
#define fixed_bitset_init(ptr, type, N, fill)
 Initialize a bitset.

Functions

static uint fixed_bitset_size (const fixed_bitset_t *bitset)
 Get the size of the bitset.
static uint fixed_bitset_word_size (const fixed_bitset_t *bitset)
 Get the size of the bitset in words.
static void check_fixed_bitset (__unused const fixed_bitset_t *bitset)
 Check that the bitset is valid.
static fixed_bitset_t * fixed_bitset_write_word (fixed_bitset_t *bitset, uint word_num, uint32_t value)
 Write a word in the bitset.
static uint32_t fixed_bitset_read_word (const fixed_bitset_t *bitset, uint word_num)
 Read a word in the bitset.
static fixed_bitset_t * fixed_bitset_clear_all (fixed_bitset_t *bitset)
 Clear all bits in the bitset.
static fixed_bitset_t * fixed_bitset_set_all (fixed_bitset_t *bitset)
 Set all bits in the bitset.
fixed_bitset_t * fixed_bitset_flip_all (fixed_bitset_t *bitset)
 Flip all bits in the bitset.
bool fixed_bitset_is_empty (fixed_bitset_t *bitset)
 Determine if bitset is empty.
static fixed_bitset_t * fixed_bitset_set (fixed_bitset_t *bitset, uint bit_index)
 Set a single bit in the bitset.
static fixed_bitset_t * fixed_bitset_clear (fixed_bitset_t *bitset, uint bit_index)
 Clear a single bit in the bitset.
static fixed_bitset_t * fixed_bitset_flip (fixed_bitset_t *bitset, uint bit_index)
 Flip a single bit in the bitset.
static bool fixed_bitset_get (const fixed_bitset_t *bitset, uint bit_index)
 Get the value of a single bit in the bitset.
static bool fixed_bitset_equal (const fixed_bitset_t *bitset1, const fixed_bitset_t *bitset2)
 Check if two bitsets are equal.

Variables

union { 
   fixed_bitset_t   bitset 
   struct { 
      uint16_t   size 
      uint16_t   word_size 
      uint32_t   words [((32)+31)/32] 
   }   sized_bitset
} __not_real_bitset32
union { 
   fixed_bitset_t   bitset 
   struct { 
      uint16_t   size 
      uint16_t   word_size 
      uint32_t   words [((33)+31)/32] 
   }   sized_bitset
} __not_real_bitset33

Macro Definition Documentation

◆ fixed_bitset_sizeof_for

#define fixed_bitset_sizeof_for ( N)
Value:
((((N) + 63u) / 32u) * 4u)