integer_encoding_library icon indicating copy to clipboard operation
integer_encoding_library copied to clipboard

A correction of decodeArray(..) in every one algorithm class

Open floodfill opened this issue 13 years ago • 1 comments

Take Simple16 as an example, the decodeArray is rendered as following:

decodeArray(uint32_t _in, uint32_t len, uint32_t *out, uint32_t nvalue){ uint32_t *end = out + nvalue; while (end > out) { (__simple16_unpack[_in >> (32 - SIMPLE16_LOGDESC)])(&out, &in); } }

According to my understanding of this function, the len indicates the count of numbers to be decompressed, and nvalue should be returned as the count of numbers decompressed to be. So I suggest correct this part of file to be following:

decodeArray(uint32_t _in, uint32_t len, uint32_t *out, uint32_t &nvalue){ uint32_t *end = in + len; uint32_t *last; uint32_t count = 0; while (end > in) { (__simple16_unpack[_in >> (32 - SIMPLE16_LOGDESC)])(&out, &in); count += in - last; last = in;
} nvalue = count; }

floodfill avatar May 19 '12 00:05 floodfill

Yep, you're right, and my code's slightly wrong..., so I'll fix it in a few days following your points. Thx :))

maropu avatar Jun 07 '12 01:06 maropu