BITFIELD: Farest bit set is offset+bits-1. Off by one error fixed.

This commit is contained in:
antirez 2016-03-02 16:20:28 +01:00
parent 9a00da0d14
commit fc843784c3

View File

@ -964,8 +964,10 @@ void bitfieldCommand(client *c) {
* for simplicity. SET return value is the previous value so * for simplicity. SET return value is the previous value so
* we need fetch & store as well. */ * we need fetch & store as well. */
if ((o = lookupStringForBitCommand(c,thisop->offset + thisop->bits)) /* Lookup by making room up to the farest bit reached by
== NULL) return; * this operation. */
if ((o = lookupStringForBitCommand(c,
thisop->offset + (thisop->bits-1))) == NULL) return;
/* We need two different but very similar code paths for signed /* We need two different but very similar code paths for signed
* and unsigned operations, since the set of functions to get/set * and unsigned operations, since the set of functions to get/set