libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
GblBitView Struct Reference

#include <gimbal_bit_view.h>

Data Fields

union { 
 
   void *   pData 
 
   uint8_t *   pBytes 
 
   uint32_t *   pWords 
 
};  
 
size_t length
 
uint8_t offset
 

Detailed Description

Mutable view to a field of bits within some block of memory.

GblBitView is a view-based container, which does not own, but simply references, an existing field of bits within another buffer. It provides a comparable API to that of a "BitArray," "BitVector," "BitMap," or "BitSet," as they're often known.

GblBitView allows you to conveniently refer a range of bits as though they were a regular array, allowing you to perform operations on them individually. Certain operations such as count, set, reset, and flip, are implemented with optimized algorithms that operate either per-word or per-byte, rather than requiring iteration over every bit.

Note
Even though GblBitView is a view, which does not "own" the memory it is backed by, certain function overloads are able to create alloca()-backed stack memory on-the-fly to associate with the view, so you don't have to provide a backing buffer for it.
See also
GblByteArray
Todo:
  • finish implementation
  • decide on API for bitwise ops against others

Definition at line 53 of file gimbal_bit_view.h.

Field Documentation

◆ pData

void* GblBitView::pData

Definition at line 55 of file gimbal_bit_view.h.

◆ pBytes

uint8_t* GblBitView::pBytes

Definition at line 56 of file gimbal_bit_view.h.

◆ pWords

uint32_t* GblBitView::pWords

Definition at line 57 of file gimbal_bit_view.h.

◆ length

size_t GblBitView::length

Definition at line 59 of file gimbal_bit_view.h.

◆ offset

uint8_t GblBitView::offset

Definition at line 60 of file gimbal_bit_view.h.


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