12 std::vector<uint8_t> data(ptr, ptr + len);
94 while (length-- != 0) {
96 value |= this->
data_[--index];
99 while (length-- != 0) {
109 uint32_t mask = (~static_cast<uint32_t>(0)) << 23;
110 if ((value & mask) != 0)
127 return {start, start + length};
139 while (length-- != 0) {
146 while (length-- != 0) {
147 this->
data_[--index] =
static_cast<uint8_t
>(value);
153 static_assert(
sizeof(
float) ==
sizeof(uint32_t),
"Float sizes other than 32 bit not supported");
158 static_assert(
sizeof(
double) ==
sizeof(uint64_t),
"Double sizes other than 64 bit not supported");
164 std::copy(value.begin(), value.end(), this->
data_.begin() + this->
position_);
void put_uint32(uint32_t value)
void set_limit(size_t limit)
void put_uint64(uint64_t value)
std::vector< uint8_t > data_
static ByteBuffer wrap(std::vector< uint8_t > const &data, Endian endianness=LITTLE)
Wrap an existing vector in a ByteBufffer.
std::vector< uint8_t > get_vector(size_t length)
void put_uint8(uint8_t value)
Putters.
uint8_t get_uint8()
Getters.
void put_uint(uint64_t value, size_t length)
void put_double(double value)
uint64_t get_uint(size_t length)
void put_uint16(uint16_t value)
size_t get_capacity() const
void put_float(float value)
size_t get_remaining() const
To bit_cast(const From &src)
Convert data between types, without aliasing issues or undefined behaviour.
void set_position(size_t position)
Implementation of SPI Controller mode.
A class modelled on the Java ByteBuffer class.
void put_vector(const std::vector< uint8_t > &value)