hllSparseSum(): multiply 1 * runlen for zero entries.

This commit is contained in:
antirez 2014-04-12 16:47:50 +02:00
parent 2c3256769c
commit 30476ea26f

View File

@ -823,13 +823,13 @@ double hllSparseSum(uint8_t *sparse, int sparselen, double *PE, int *ezp) {
runlen = HLL_SPARSE_ZERO_LEN(p); runlen = HLL_SPARSE_ZERO_LEN(p);
idx += runlen; idx += runlen;
ez += runlen; ez += runlen;
E += 1; /* 2^(-reg[j]) is 1 when m is 0. */ E += 1*runlen; /* 2^(-reg[j]) is 1 when m is 0. */
p++; p++;
} else if (HLL_SPARSE_IS_XZERO(p)) { } else if (HLL_SPARSE_IS_XZERO(p)) {
runlen = HLL_SPARSE_XZERO_LEN(p); runlen = HLL_SPARSE_XZERO_LEN(p);
idx += runlen; idx += runlen;
ez += runlen; ez += runlen;
E += 1; /* 2^(-reg[j]) is 1 when m is 0. */ E += 1*runlen; /* 2^(-reg[j]) is 1 when m is 0. */
p += 2; p += 2;
} else { } else {
runlen = HLL_SPARSE_VAL_LEN(p); runlen = HLL_SPARSE_VAL_LEN(p);