Pixie
Loading...
Searching...
No Matches
pixie::experimental::PermutedBitBlock< Permuted > Class Template Reference

Bounded owning experiment, independent of sequence split/merge policy. More...

#include <permuted_bit_block.h>

Public Types

using value_type = bool
 Logical element type returned by value.
 
using Payload = std::array<std::uint64_t, 32>
 Fixed owning payload, in least-significant-bit-first word order.
 

Public Member Functions

 PermutedBitBlock () noexcept=default
 Construct empty; all storage is initialized.
 
 PermutedBitBlock (std::span< const std::uint64_t > words, std::size_t n)
 Copy n bits, ignoring extra words and high padding bits.
 
std::size_t size () const noexcept
 Query the logical length.
 
bool empty () const noexcept
 Query whether the block is empty.
 
bool operator[] (std::size_t i) const
 Read a zero-based logical bit by value.
 
Payload flatten () const noexcept
 Copy logical bits to linear words without mutating the block.
 
void rotate_left (std::size_t left, std::size_t right, std::size_t distance) noexcept
 Rotate [left, right) left by distance modulo its length.
 
std::size_t payload_capacity_bytes () const noexcept
 Query fixed payload capacity.
 
std::size_t metadata_bytes () const noexcept
 Query object metadata size; there is no dynamic allocation.
 
void redistribute (PermutedBitBlock &rhs, std::size_t left_size) noexcept
 Repartition two distinct blocks without allocation or exceptions.
 

Static Public Attributes

static constexpr std::size_t capacity = 2048
 Maximum logical element count.
 

Detailed Description

template<bool Permuted = true>
class pixie::experimental::PermutedBitBlock< Permuted >

Bounded owning experiment, independent of sequence split/merge policy.

Holds 0..2048 bits in 16 physical 128-bit chunks. With Permuted=true, nibble j of a uint64_t maps canonical chunk j to its physical chunk. Circular origin h is applied modulo the valid length BEFORE this mapping. Whole-block rotation changes only h. At h=0, chunk-aligned subranges rotate map nibbles without touching payload (including in partially filled blocks). Other rotations gather only the affected interval in rotated order, then scatter through the same map, preserving both the permutation and origin. Copies translate contiguous chunk pieces, never individual bits.

Permuted=false is the matched direct-movement control: the same packed copy primitive and circular-origin fast path, without a map or descriptor lookup. Value copies own independent payloads. No allocation or external lifetime.

Template Parameters
PermutedWhether to map canonical chunks to physical chunks; false selects the direct-movement control.

Constructor & Destructor Documentation

◆ PermutedBitBlock()

template<bool Permuted = true>
pixie::experimental::PermutedBitBlock< Permuted >::PermutedBitBlock ( std::span< const std::uint64_t > words,
std::size_t n )
inline

Copy n bits, ignoring extra words and high padding bits.

The source need not outlive the block. Bits are copied in least-significant-bit-first word order, with initial circular origin h = 0.

Parameters
wordsSource words containing the bits to copy.
nValid logical bit count, from 0 through 2048 inclusive.
Exceptions
std::invalid_argumentIf n > 2048 or words does not cover n bits.

Member Function Documentation

◆ empty()

template<bool Permuted = true>
bool pixie::experimental::PermutedBitBlock< Permuted >::empty ( ) const
inlinenoexcept

Query whether the block is empty.

Returns
True if there are no valid bits.

◆ flatten()

template<bool Permuted = true>
Payload pixie::experimental::PermutedBitBlock< Permuted >::flatten ( ) const
inlinenoexcept

Copy logical bits to linear words without mutating the block.

Copies at most 256 bytes and does not allocate.

Returns
Owning LSB-first payload with all bits beyond size() set to zero.

◆ metadata_bytes()

template<bool Permuted = true>
std::size_t pixie::experimental::PermutedBitBlock< Permuted >::metadata_bytes ( ) const
inlinenoexcept

Query object metadata size; there is no dynamic allocation.

Returns
Object bytes excluding the payload, including any padding.

◆ operator[]()

template<bool Permuted = true>
bool pixie::experimental::PermutedBitBlock< Permuted >::operator[] ( std::size_t i) const
inline

Read a zero-based logical bit by value.

Parameters
iBit position in [0, size()).
Returns
The logical bit value.
Exceptions
std::out_of_rangeIf i >= size().

◆ payload_capacity_bytes()

template<bool Permuted = true>
std::size_t pixie::experimental::PermutedBitBlock< Permuted >::payload_capacity_bytes ( ) const
inlinenoexcept

Query fixed payload capacity.

Returns
Payload bytes, including unused capacity.

◆ redistribute()

template<bool Permuted = true>
void pixie::experimental::PermutedBitBlock< Permuted >::redistribute ( PermutedBitBlock< Permuted > & rhs,
std::size_t left_size )
inlinenoexcept

Repartition two distinct blocks without allocation or exceptions.

Preserves concatenated logical contents; length changes normalize the maps and origins. Ordinary rotations retain their existing kernels. Requires left_size <= capacity and left_size <= size()+rhs.size() <= left_size+capacity. Invalid primitive arguments are asserted.

Parameters
rhsRight block, receiving the suffix.
left_sizeDesired valid count in this block.

◆ rotate_left()

template<bool Permuted = true>
void pixie::experimental::PermutedBitBlock< Permuted >::rotate_left ( std::size_t left,
std::size_t right,
std::size_t distance )
inlinenoexcept

Rotate [left, right) left by distance modulo its length.

Empty ranges and zero effective distances do nothing. Bits outside the range remain unchanged.

Parameters
leftInclusive zero-based start of the range.
rightExclusive end of the range.
distanceLeft rotation distance in bits, reduced modulo range length.
Precondition
left <= right <= size(); invalid primitive arguments are asserted.

◆ size()

template<bool Permuted = true>
std::size_t pixie::experimental::PermutedBitBlock< Permuted >::size ( ) const
inlinenoexcept

Query the logical length.

Returns
Valid logical bit count, excluding capacity and padding.

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