Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::Internal::BitPacking Namespace Reference

Typedefs

using Word_t = std::uintmax_t
 

Functions

constexpr std::size_t MinBufSize (std::size_t count, std::size_t nDstBits)
 Returns the minimum safe size (in bytes) of a buffer that is intended to be used as a destination for PackBits or a source for UnpackBits.
 
void PackBits (void *dst, const void *src, std::size_t count, std::size_t sizeofSrc, std::size_t nDstBits)
 Tightly packs count items of size sizeofSrc contained in src into dst using nDstBits per item.
 
void UnpackBits (void *dst, const void *src, std::size_t count, std::size_t sizeofDst, std::size_t nSrcBits)
 Undoes the effect of PackBits.
 

Variables

constexpr std::size_t kBitsPerWord = sizeof(Word_t) * 8
 

Typedef Documentation

◆ Word_t

using ROOT::Experimental::Internal::BitPacking::Word_t = typedef std::uintmax_t

Definition at line 32 of file RColumnElement.hxx.

Function Documentation

◆ MinBufSize()

constexpr std::size_t ROOT::Experimental::Internal::BitPacking::MinBufSize ( std::size_t  count,
std::size_t  nDstBits 
)
constexpr

Returns the minimum safe size (in bytes) of a buffer that is intended to be used as a destination for PackBits or a source for UnpackBits.

Passing a buffer that's less than this size will cause invalid memory reads and writes.

Definition at line 38 of file RColumnElement.hxx.

◆ PackBits()

void ROOT::Experimental::Internal::BitPacking::PackBits ( void *  dst,
const void *  src,
std::size_t  count,
std::size_t  sizeofSrc,
std::size_t  nDstBits 
)

Tightly packs count items of size sizeofSrc contained in src into dst using nDstBits per item.

It must be 0 < sizeofSrc <= 8 and 0 < nDstBits <= sizeofSrc * 8. The extra least significant bits are dropped (assuming LE ordering of the items in src). Note that this function doesn't do any byte reordering for you. IMPORTANT: the size of dst must be at least MinBufSize(count, nBitBits)

Definition at line 203 of file RColumnElement.cxx.

◆ UnpackBits()

void ROOT::Experimental::Internal::BitPacking::UnpackBits ( void *  dst,
const void *  src,
std::size_t  count,
std::size_t  sizeofDst,
std::size_t  nSrcBits 
)

Undoes the effect of PackBits.

The bits that were truncated in the packed representation are filled with zeroes. src must be at least MinBufSize(count, nDstBits) bytes long. dst must be at least count * sizeofDst bytes long.

Definition at line 259 of file RColumnElement.cxx.

Variable Documentation

◆ kBitsPerWord

constexpr std::size_t ROOT::Experimental::Internal::BitPacking::kBitsPerWord = sizeof(Word_t) * 8
inlineconstexpr

Definition at line 33 of file RColumnElement.hxx.