mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2025-02-20 23:38:32 +00:00
Improve bit_buffer.h docs (#3783)
* Improve bit_buffer.h docs * Toolbox: update doxygen comments fix spelling * Toolbox: update bit lib docs Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
parent
56d2923f1f
commit
00c1611c33
1 changed files with 208 additions and 170 deletions
|
@ -1,3 +1,9 @@
|
|||
/** Bit Buffer
|
||||
*
|
||||
* Various bits and bytes manipulation tools.
|
||||
*
|
||||
* @file bit_buffer.h
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
@ -10,118 +16,128 @@ extern "C" {
|
|||
|
||||
typedef struct BitBuffer BitBuffer;
|
||||
|
||||
// Construction, deletion, reset
|
||||
|
||||
/**
|
||||
* Allocate a BitBuffer instance.
|
||||
/** Allocate a BitBuffer instance.
|
||||
*
|
||||
* @param [in] capacity_bytes maximum buffer capacity, in bytes
|
||||
* @return pointer to the allocated BitBuffer instance
|
||||
* @param[in] capacity_bytes maximum buffer capacity, in bytes
|
||||
*
|
||||
* @return pointer to the allocated BitBuffer instance
|
||||
*/
|
||||
BitBuffer* bit_buffer_alloc(size_t capacity_bytes);
|
||||
|
||||
/**
|
||||
* Delete a BitBuffer instance.
|
||||
/** Delete a BitBuffer instance.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance
|
||||
* @param[in,out] buf pointer to a BitBuffer instance
|
||||
*/
|
||||
void bit_buffer_free(BitBuffer* buf);
|
||||
|
||||
/**
|
||||
* Clear all data from a BitBuffer instance.
|
||||
/** Clear all data from a BitBuffer instance.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance
|
||||
* @param[in,out] buf pointer to a BitBuffer instance
|
||||
*/
|
||||
void bit_buffer_reset(BitBuffer* buf);
|
||||
|
||||
// Copy and write
|
||||
|
||||
/**
|
||||
* Copy another BitBuffer instance's contents to this one, replacing
|
||||
* all of the original data.
|
||||
* The destination capacity must be no less than the source data size.
|
||||
/** Copy another BitBuffer instance's contents to this one, replacing all of the
|
||||
* original data.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param [in] other pointer to a BitBuffer instance to copy from
|
||||
* @note
|
||||
* @warning The destination capacity must be no less than the source data
|
||||
* size.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param[in] other pointer to a BitBuffer instance to copy from
|
||||
*/
|
||||
void bit_buffer_copy(BitBuffer* buf, const BitBuffer* other);
|
||||
|
||||
/**
|
||||
* Copy all BitBuffer instance's contents to this one, starting from start_index,
|
||||
* replacing all of the original data.
|
||||
* The destination capacity must be no less than the source data size
|
||||
* counting from start_index.
|
||||
/** Copy all BitBuffer instance's contents to this one, starting from
|
||||
* start_index, replacing all of the original data.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param [in] other pointer to a BitBuffer instance to copy from
|
||||
* @param [in] start_index index to begin copying source data from
|
||||
* @warning The destination capacity must be no less than the source data
|
||||
* size counting from start_index.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param[in] other pointer to a BitBuffer instance to copy from
|
||||
* @param[in] start_index index to begin copying source data from
|
||||
*/
|
||||
void bit_buffer_copy_right(BitBuffer* buf, const BitBuffer* other, size_t start_index);
|
||||
|
||||
/**
|
||||
* Copy all BitBuffer instance's contents to this one, ending with end_index,
|
||||
/** Copy all BitBuffer instance's contents to this one, ending with end_index,
|
||||
* replacing all of the original data.
|
||||
* The destination capacity must be no less than the source data size
|
||||
* counting to end_index.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param [in] other pointer to a BitBuffer instance to copy from
|
||||
* @param [in] end_index index to end copying source data at
|
||||
* @warning The destination capacity must be no less than the source data
|
||||
* size counting to end_index.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param[in] other pointer to a BitBuffer instance to copy from
|
||||
* @param[in] end_index index to end copying source data at
|
||||
*/
|
||||
void bit_buffer_copy_left(BitBuffer* buf, const BitBuffer* other, size_t end_index);
|
||||
|
||||
/**
|
||||
* Copy a byte array to a BitBuffer instance, replacing all of the original data.
|
||||
* The destination capacity must be no less than the source data size.
|
||||
/** Copy a byte array to a BitBuffer instance, replacing all of the original
|
||||
* data.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param [in] data pointer to the byte array to be copied
|
||||
* @param [in] size_bytes size of the data to be copied, in bytes
|
||||
* @warning The destination capacity must be no less than the source data
|
||||
* size.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param[in] data pointer to the byte array to be copied
|
||||
* @param[in] size_bytes size of the data to be copied, in bytes
|
||||
*/
|
||||
void bit_buffer_copy_bytes(BitBuffer* buf, const uint8_t* data, size_t size_bytes);
|
||||
|
||||
/**
|
||||
* Copy a byte array to a BitBuffer instance, replacing all of the original data.
|
||||
* The destination capacity must be no less than the source data size.
|
||||
/** Copy a byte array to a BitBuffer instance, replacing all of the original
|
||||
* data.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param [in] data pointer to the byte array to be copied
|
||||
* @param [in] size_bits size of the data to be copied, in bits
|
||||
* @warning The destination capacity must be no less than the source data
|
||||
* size.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param[in] data pointer to the byte array to be copied
|
||||
* @param[in] size_bits size of the data to be copied, in bits
|
||||
*/
|
||||
void bit_buffer_copy_bits(BitBuffer* buf, const uint8_t* data, size_t size_bits);
|
||||
|
||||
/**
|
||||
* Copy a byte with parity array to a BitBuffer instance, replacing all of the original data.
|
||||
* The destination capacity must be no less than the source data size.
|
||||
/** Copy a byte with parity array to a BitBuffer instance, replacing all of the
|
||||
* original data.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param [in] data pointer to the byte array to be copied
|
||||
* @param [in] size_bitss size of the data to be copied, in bits
|
||||
* @warning The destination capacity must be no less than the source data
|
||||
* size.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to copy into
|
||||
* @param[in] data pointer to the byte array to be copied
|
||||
* @param[in] size_bits size of the data to be copied, in bits
|
||||
* @note Parity bits are placed starting with the most significant bit
|
||||
* of each byte and moving up.
|
||||
* @note Example: DDDDDDDD PDDDDDDD DPDDDDDD DDP...
|
||||
*/
|
||||
void bit_buffer_copy_bytes_with_parity(BitBuffer* buf, const uint8_t* data, size_t size_bits);
|
||||
|
||||
/**
|
||||
* Write a BitBuffer instance's entire contents to an arbitrary memory location.
|
||||
* The destination memory must be allocated. Additionally, the destination
|
||||
* capacity must be no less than the source data size.
|
||||
/** Write a BitBuffer instance's entire contents to an arbitrary memory location.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to write from
|
||||
* @param [out] dest pointer to the destination memory location
|
||||
* @param [in] size_bytes maximum destination data size, in bytes
|
||||
* @warning The destination memory must be allocated. Additionally, the
|
||||
* destination capacity must be no less than the source data size.
|
||||
*
|
||||
* @param[in] buf pointer to a BitBuffer instance to write from
|
||||
* @param[out] dest pointer to the destination memory location
|
||||
* @param[in] size_bytes maximum destination data size, in bytes
|
||||
*/
|
||||
void bit_buffer_write_bytes(const BitBuffer* buf, void* dest, size_t size_bytes);
|
||||
|
||||
/**
|
||||
* Write a BitBuffer instance's entire contents to an arbitrary memory location.
|
||||
* Additionally, place a parity bit after each byte.
|
||||
* The destination memory must be allocated. Additionally, the destination
|
||||
* capacity must be no less than the source data size plus parity.
|
||||
/** Write a BitBuffer instance's entire contents to an arbitrary memory location.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to write from
|
||||
* @param [out] dest pointer to the destination memory location
|
||||
* @param [in] size_bytes maximum destination data size, in bytes
|
||||
* @param [out] bits_written actual number of bits writen, in bits
|
||||
* Additionally, place a parity bit after each byte.
|
||||
*
|
||||
* @warning The destination memory must be allocated. Additionally, the
|
||||
* destination capacity must be no less than the source data size
|
||||
* plus parity.
|
||||
*
|
||||
* @param[in] buf pointer to a BitBuffer instance to write from
|
||||
* @param[out] dest pointer to the destination memory location
|
||||
* @param[in] size_bytes maximum destination data size, in bytes
|
||||
* @param[out] bits_written actual number of bits written, in bits
|
||||
* @note Parity bits are placed starting with the most significant bit of
|
||||
* each byte and moving up.
|
||||
* @note Example: DDDDDDDD PDDDDDDD DPDDDDDD DDP...
|
||||
*/
|
||||
void bit_buffer_write_bytes_with_parity(
|
||||
const BitBuffer* buf,
|
||||
|
@ -129,15 +145,17 @@ void bit_buffer_write_bytes_with_parity(
|
|||
size_t size_bytes,
|
||||
size_t* bits_written);
|
||||
|
||||
/**
|
||||
* Write a slice of BitBuffer instance's contents to an arbitrary memory location.
|
||||
* The destination memory must be allocated. Additionally, the destination
|
||||
* capacity must be no less than the requested slice size.
|
||||
/** Write a slice of BitBuffer instance's contents to an arbitrary memory
|
||||
* location.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to write from
|
||||
* @param [out] dest pointer to the destination memory location
|
||||
* @param [in] start_index index to begin copying source data from
|
||||
* @param [in] size_bytes data slice size, in bytes
|
||||
* @warning The destination memory must be allocated. Additionally, the
|
||||
* destination capacity must be no less than the requested slice
|
||||
* size.
|
||||
*
|
||||
* @param[in] buf pointer to a BitBuffer instance to write from
|
||||
* @param[out] dest pointer to the destination memory location
|
||||
* @param[in] start_index index to begin copying source data from
|
||||
* @param[in] size_bytes data slice size, in bytes
|
||||
*/
|
||||
void bit_buffer_write_bytes_mid(
|
||||
const BitBuffer* buf,
|
||||
|
@ -147,176 +165,196 @@ void bit_buffer_write_bytes_mid(
|
|||
|
||||
// Checks
|
||||
|
||||
/**
|
||||
* Check whether a BitBuffer instance contains a partial byte (i.e. the bit count
|
||||
* is not divisible by 8).
|
||||
/** Check whether a BitBuffer instance contains a partial byte (i.e.\ the bit
|
||||
* count is not divisible by 8).
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be checked
|
||||
* @return true if the instance contains a partial byte, false otherwise
|
||||
* @param[in] buf pointer to a BitBuffer instance to be checked
|
||||
*
|
||||
* @return true if the instance contains a partial byte, false otherwise
|
||||
*/
|
||||
bool bit_buffer_has_partial_byte(const BitBuffer* buf);
|
||||
|
||||
/**
|
||||
* Check whether a BitBuffer instance's contents start with the designated byte.
|
||||
/** Check whether a BitBuffer instance's contents start with the designated byte.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be checked
|
||||
* @param [in] byte byte value to be checked against
|
||||
* @return true if data starts with designated byte, false otherwise
|
||||
* @param[in] buf pointer to a BitBuffer instance to be checked
|
||||
* @param[in] byte byte value to be checked against
|
||||
*
|
||||
* @return true if data starts with designated byte, false otherwise
|
||||
*/
|
||||
bool bit_buffer_starts_with_byte(const BitBuffer* buf, uint8_t byte);
|
||||
|
||||
// Getters
|
||||
|
||||
/**
|
||||
* Get a BitBuffer instance's capacity (i.e. the maximum possible amount of data), in bytes.
|
||||
/** Get a BitBuffer instance's capacity (i.e.\ the maximum possible amount of
|
||||
* data), in bytes.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be queried
|
||||
* @return capacity, in bytes
|
||||
* @param[in] buf pointer to a BitBuffer instance to be queried
|
||||
*
|
||||
* @return capacity, in bytes
|
||||
*/
|
||||
size_t bit_buffer_get_capacity_bytes(const BitBuffer* buf);
|
||||
|
||||
/**
|
||||
* Get a BitBuffer instance's data size (i.e. the amount of stored data), in bits.
|
||||
* Might be not divisible by 8 (see bit_buffer_is_partial_byte).
|
||||
/** Get a BitBuffer instance's data size (i.e.\ the amount of stored data), in
|
||||
* bits.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be queried
|
||||
* @return data size, in bits.
|
||||
* @warning Might be not divisible by 8 (see bit_buffer_is_partial_byte).
|
||||
*
|
||||
* @param[in] buf pointer to a BitBuffer instance to be queried
|
||||
*
|
||||
* @return data size, in bits.
|
||||
*/
|
||||
size_t bit_buffer_get_size(const BitBuffer* buf);
|
||||
|
||||
/**
|
||||
* Get a BitBuffer instance's data size (i.e. the amount of stored data), in bytes.
|
||||
* If a partial byte is present, it is also counted.
|
||||
* Get a BitBuffer instance's data size (i.e.\ the amount of stored data), in
|
||||
* bytes.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be queried
|
||||
* @return data size, in bytes.
|
||||
* @warning If a partial byte is present, it is also counted.
|
||||
*
|
||||
* @param[in] buf pointer to a BitBuffer instance to be queried
|
||||
*
|
||||
* @return data size, in bytes.
|
||||
*/
|
||||
size_t bit_buffer_get_size_bytes(const BitBuffer* buf);
|
||||
|
||||
/**
|
||||
* Get a byte value at a specified index in a BitBuffer instance.
|
||||
* The index must be valid (i.e. less than the instance's data size in bytes).
|
||||
/** Get a byte value at a specified index in a BitBuffer instance.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be queried
|
||||
* @param [in] index index of the byte in question
|
||||
* @warning The index must be valid (i.e.\ less than the instance's data size
|
||||
* in bytes).
|
||||
*
|
||||
* @param[in] buf pointer to a BitBuffer instance to be queried
|
||||
* @param[in] index index of the byte in question
|
||||
*
|
||||
* @return byte value
|
||||
*/
|
||||
uint8_t bit_buffer_get_byte(const BitBuffer* buf, size_t index);
|
||||
|
||||
/**
|
||||
* Get a byte value starting from the specified bit index in a BitBuffer instance.
|
||||
* The resulting byte might correspond to a single byte (if the index is a multiple
|
||||
* of 8), or two overlapping bytes combined.
|
||||
* The index must be valid (i.e. less than the instance's data size in bits).
|
||||
/** Get a byte value starting from the specified bit index in a BitBuffer
|
||||
* instance.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be queried
|
||||
* @param [in] index bit index of the byte in question
|
||||
* @warning The resulting byte might correspond to a single byte (if the
|
||||
* index is a multiple of 8), or two overlapping bytes combined. The
|
||||
* index must be valid (i.e.\ less than the instance's data size in
|
||||
* bits).
|
||||
*
|
||||
* @param[in] buf pointer to a BitBuffer instance to be queried
|
||||
* @param[in] index_bits bit index of the byte in question
|
||||
*
|
||||
* @return byte value
|
||||
*/
|
||||
uint8_t bit_buffer_get_byte_from_bit(const BitBuffer* buf, size_t index_bits);
|
||||
|
||||
/**
|
||||
* Get the pointer to a BitBuffer instance's underlying data.
|
||||
/** Get the pointer to a BitBuffer instance's underlying data.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be queried
|
||||
* @return pointer to the underlying data
|
||||
* @param[in] buf pointer to a BitBuffer instance to be queried
|
||||
*
|
||||
* @return pointer to the underlying data
|
||||
*/
|
||||
const uint8_t* bit_buffer_get_data(const BitBuffer* buf);
|
||||
|
||||
/**
|
||||
* Get the pointer to a BitBuffer instance's underlying data.
|
||||
/** Get the pointer to the parity data of a BitBuffer instance.
|
||||
*
|
||||
* @param [in] buf pointer to a BitBuffer instance to be queried
|
||||
* @return pointer to the underlying data
|
||||
* @param[in] buf pointer to a BitBuffer instance to be queried
|
||||
*
|
||||
* @return pointer to the parity data
|
||||
*/
|
||||
const uint8_t* bit_buffer_get_parity(const BitBuffer* buf);
|
||||
|
||||
// Setters
|
||||
|
||||
/**
|
||||
* Set byte value at a specified index in a BitBuffer instance.
|
||||
* The index must be valid (i.e. less than the instance's data size in bytes).
|
||||
/** Set byte value at a specified index in a BitBuffer instance.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be modified
|
||||
* @param [in] index index of the byte in question
|
||||
* @param [in] byte byte value to be set at index
|
||||
* @warning The index must be valid (i.e.\ less than the instance's data
|
||||
* size in bytes).
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be modified
|
||||
* @param[in] index index of the byte in question
|
||||
* @param[in] byte byte value to be set at index
|
||||
*/
|
||||
void bit_buffer_set_byte(BitBuffer* buf, size_t index, uint8_t byte);
|
||||
|
||||
/**
|
||||
* Set byte and parity bit value at a specified index in a BitBuffer instance.
|
||||
* The index must be valid (i.e. less than the instance's data size in bytes).
|
||||
/** Set byte and parity bit value at a specified index in a BitBuffer instance.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be modified
|
||||
* @param [in] index index of the byte in question
|
||||
* @param [in] byte byte value to be set at index
|
||||
* @param [in] parity parity bit value to be set at index
|
||||
* @warning The index must be valid (i.e.\ less than the instance's data
|
||||
* size in bytes).
|
||||
*
|
||||
* @param[in,out] buff pointer to a BitBuffer instance to be modified
|
||||
* @param[in] index index of the byte in question
|
||||
* @param[in] byte byte value to be set at index
|
||||
* @param[in] parity parity bit value to be set at index
|
||||
*/
|
||||
void bit_buffer_set_byte_with_parity(BitBuffer* buff, size_t index, uint8_t byte, bool parity);
|
||||
|
||||
/**
|
||||
* Resize a BitBuffer instance to a new size, in bits.
|
||||
* @warning May cause bugs. Use only if absolutely necessary.
|
||||
/** Resize a BitBuffer instance to a new size, in bits.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be resized
|
||||
* @param [in] new_size the new size of the buffer, in bits
|
||||
* @warning May cause bugs. Use only if absolutely necessary.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be resized
|
||||
* @param[in] new_size the new size of the buffer, in bits
|
||||
*/
|
||||
void bit_buffer_set_size(BitBuffer* buf, size_t new_size);
|
||||
|
||||
/**
|
||||
* Resize a BitBuffer instance to a new size, in bytes.
|
||||
* @warning May cause bugs. Use only if absolutely necessary.
|
||||
/** Resize a BitBuffer instance to a new size, in bytes.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be resized
|
||||
* @param [in] new_size_bytes the new size of the buffer, in bytes
|
||||
* @warning May cause bugs. Use only if absolutely necessary.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be resized
|
||||
* @param[in] new_size_bytes the new size of the buffer, in bytes
|
||||
*/
|
||||
void bit_buffer_set_size_bytes(BitBuffer* buf, size_t new_size_bytes);
|
||||
|
||||
// Modification
|
||||
|
||||
/**
|
||||
* Append all BitBuffer's instance contents to this one. The destination capacity
|
||||
* must be no less than its original data size plus source data size.
|
||||
/** Append all BitBuffer's instance contents to this one.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param [in] other pointer to a BitBuffer instance to be appended
|
||||
* @warning The destination capacity must be no less than its original
|
||||
* data size plus source data size.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param[in] other pointer to a BitBuffer instance to be appended
|
||||
*/
|
||||
void bit_buffer_append(BitBuffer* buf, const BitBuffer* other);
|
||||
|
||||
/**
|
||||
* Append a BitBuffer's instance contents to this one, starting from start_index.
|
||||
* The destination capacity must be no less than the source data size
|
||||
* counting from start_index.
|
||||
/** Append a BitBuffer's instance contents to this one, starting from
|
||||
* start_index.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param [in] other pointer to a BitBuffer instance to be appended
|
||||
* @param [in] start_index index to begin copying source data from
|
||||
* @warning The destination capacity must be no less than the source data
|
||||
* size counting from start_index.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param[in] other pointer to a BitBuffer instance to be appended
|
||||
* @param[in] start_index index to begin copying source data from
|
||||
*/
|
||||
void bit_buffer_append_right(BitBuffer* buf, const BitBuffer* other, size_t start_index);
|
||||
|
||||
/**
|
||||
* Append a byte to a BitBuffer instance.
|
||||
* The destination capacity must be no less its original data size plus one.
|
||||
/** Append a byte to a BitBuffer instance.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param [in] byte byte value to be appended
|
||||
* @warning The destination capacity must be no less its original data
|
||||
* size plus one.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param[in] byte byte value to be appended
|
||||
*/
|
||||
void bit_buffer_append_byte(BitBuffer* buf, uint8_t byte);
|
||||
|
||||
/**
|
||||
* Append a byte array to a BitBuffer instance.
|
||||
* The destination capacity must be no less its original data size plus source data size.
|
||||
/** Append a byte array to a BitBuffer instance.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param [in] data pointer to the byte array to be appended
|
||||
* @param [in] size_bytes size of the data to be appended, in bytes
|
||||
* @warning The destination capacity must be no less its original data
|
||||
* size plus source data size.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param[in] data pointer to the byte array to be appended
|
||||
* @param[in] size_bytes size of the data to be appended, in bytes
|
||||
*/
|
||||
void bit_buffer_append_bytes(BitBuffer* buf, const uint8_t* data, size_t size_bytes);
|
||||
|
||||
/**
|
||||
* Append a bit to a BitBuffer instance.
|
||||
* The destination capacity must be sufficient to accomodate the additional bit.
|
||||
/** Append a bit to a BitBuffer instance.
|
||||
*
|
||||
* @param [in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param [in] bit bit value to be appended
|
||||
* @warning The destination capacity must be sufficient to accommodate the
|
||||
* additional bit.
|
||||
*
|
||||
* @param[in,out] buf pointer to a BitBuffer instance to be appended to
|
||||
* @param[in] bit bit value to be appended
|
||||
*/
|
||||
void bit_buffer_append_bit(BitBuffer* buf, bool bit);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue