提交 7f29a4a6 编写于 作者: H Haojun Liao

refactor: do some internal refactor.

上级 0966528a
......@@ -286,12 +286,9 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
if (selector == 0 || selector == 1) {
int32_t batch = elems >> 2;
int32_t remainder = elems & 0x3;
int32_t gRemainder = nelements - count;
int32_t gBatch = gRemainder >> 2;
int32_t gBatch = (nelements - count) >> 2;
int32_t minBatch = TMIN(batch, gBatch);
int32_t minRemain = TMIN(remainder, gRemainder);
for(int32_t i = 0; i < minBatch; ++i) {
p[_pos++] = prev_value;
p[_pos++] = prev_value;
......@@ -299,20 +296,21 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
p[_pos++] = prev_value;
}
count += (minBatch << 2);
int32_t gRemainder = nelements - count;
int32_t minRemain = TMIN(remainder, gRemainder);
for (int32_t i = 0; i < minRemain; i++) {
p[_pos++] = prev_value;
}
count += ((minBatch << 2)+ minRemain);
count += minRemain;
} else {
int32_t batch = elems >> 2;
int32_t remain = elems & 0x03;
int32_t globalRemain = (nelements - count);
int32_t globalBatch = globalRemain >> 2;
int32_t globalBatch = (nelements - count) >> 2;
int32_t minBatch = TMIN(batch, globalBatch);
int32_t minRemain = TMIN(remain, globalRemain);
#if 1
// manual unrolling, to erase the hotspot
for (int32_t i = 0; i < minBatch; ++i) {
......@@ -342,6 +340,10 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
}
// handle the remain
count += (minBatch << 2);
int32_t globalRemain = (nelements - count);
int32_t minRemain = TMIN(remain, globalRemain);
for (int32_t i = 0; i < minRemain; i++) {
zigzag_value = ((w >> v) & mask);
prev_value += ZIGZAG_DECODE(int64_t, zigzag_value);
......@@ -350,7 +352,7 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
v += bit;
}
count += ((minBatch << 2)+ minRemain);
count += minRemain;
#else
for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
zigzag_value = ((w >> (4 + v)) & mask);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册