X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/f9d5c4e33c8b03d20bd9e4ec145792c000a7210f..255eebe22167e00f74e359bc71718225d6bd70c8:/src/intset.c diff --git a/src/intset.c b/src/intset.c index 2b082b9e..13bd220e 100644 --- a/src/intset.c +++ b/src/intset.c @@ -151,7 +151,7 @@ static void intsetMoveTail(intset *is, uint32_t from, uint32_t to) { /* Insert an integer in the intset */ intset *intsetAdd(intset *is, int64_t value, uint8_t *success) { uint8_t valenc = _intsetValueEncoding(value); - uint32_t pos, offset; + uint32_t pos; if (success) *success = 1; /* Upgrade encoding if necessary. If we need to upgrade, we know that @@ -179,7 +179,7 @@ intset *intsetAdd(intset *is, int64_t value, uint8_t *success) { } /* Delete integer from intset */ -intset *intsetRemove(intset *is, int64_t value, uint8_t *success) { +intset *intsetRemove(intset *is, int64_t value, int *success) { uint8_t valenc = _intsetValueEncoding(value); uint32_t pos; if (success) *success = 0; @@ -222,6 +222,11 @@ uint32_t intsetLen(intset *is) { return is->length; } +/* Return intset blob size in bytes. */ +size_t intsetBlobLen(intset *is) { + return sizeof(intset)+is->length*is->encoding; +} + #ifdef INTSET_TEST_MAIN #include