CIRCT 23.0.0git
Loading...
Searching...
No Matches
Namespaces | Functions
BitAccess.h File Reference
#include <cstddef>
#include <cstdint>
#include <type_traits>
Include dependency graph for BitAccess.h:

Go to the source code of this file.

Namespaces

namespace  esi
 
namespace  esi::detail
 

Functions

template<typename Storage , std::size_t BitOffset, std::size_t Width>
constexpr Storage esi::detail::readUnsignedBits (const uint8_t *bytes)
 Read Width bits starting at BitOffset (LSB-first within bytes) and return them zero-extended in Storage.
 
template<typename Signed , std::size_t BitOffset, std::size_t Width>
constexpr Signed esi::detail::readSignedBits (const uint8_t *bytes)
 Read Width bits starting at BitOffset (LSB-first) and sign-extend into the signed integer type Signed.
 
template<typename Storage , std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::writeUnsignedBits (uint8_t *bytes, Storage value)
 Write the low Width bits of value into bytes starting at BitOffset (LSB-first).
 
template<typename Signed , std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::writeSignedBits (uint8_t *bytes, Signed value)
 Convenience overload for signed values.
 
template<std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::copyBitsIn (const uint8_t *src, uint8_t *dst)
 Copy Width bits out of src starting at BitOffset into dst packed LSB-first from bit 0.
 
template<std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::copyBitsOut (uint8_t *dst, const uint8_t *src)
 Inverse of copyBitsIn: take Width bits packed LSB-first from bit 0 of src and write them into dst starting at BitOffset.