11 #if !defined DEBUG && !defined __CC_ARM
22 : length(0), _memory(NULL) {}
24 Poly(uint8_t
id, uint16_t offset, uint8_t size) \
25 : length(0), _id(
id), _size(size), _offset(offset), _memory(NULL) {}
30 inline bool Append(uint8_t num) {
31 assert(length+1 < _size);
32 ptr()[length++] = num;
37 inline void Init(uint8_t
id, uint16_t offset, uint8_t size, uint8_t** memory_ptr) {
39 this->_offset = offset;
42 this->_memory = memory_ptr;
47 memset((
void*)ptr(), 0, this->_size);
54 inline void Set(
const uint8_t* src, uint8_t len, uint8_t offset = 0) {
55 assert(src && len <= this->_size-offset);
56 memcpy(ptr()+offset, src, len *
sizeof(uint8_t));
57 length = len + offset;
60 #define poly_max(a, b) ((a > b) ? (a) : (b))
62 inline void Copy(
const Poly* src) {
63 length = poly_max(length, src->length);
64 Set(src->ptr(), length);
67 inline uint8_t& at(uint8_t i)
const {
72 inline uint8_t id()
const {
76 inline uint8_t size()
const {
81 inline uint8_t* ptr()
const {
82 assert(_memory && *_memory);
83 return (*_memory) + _offset;
AudioTools internal: Reed-Solomon.
Definition: gf.hpp:19