Added BITPOS command #1158

wants to merge 1 commit into


None yet

2 participants

dim commented Jun 15, 2013

I added a BITPOS operation to Redis, which accepts [start end limit] arguments. As the name suggests, it operates on bit strings and returns the positions (offsets) of all the set bits. My C is a little rusty, so it might need a little review/improvements.


The lack of explicit memory allocation and validation in this patch crashes Redis, especially on large bit sets. As a temporary, intermediate, array of set bit positions isn't actually required, this patch eliminates the crash behavior as well as exhibits substantially improved performance (by eliminating the allocation). If you're still using the command, please check it out: #1295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment