-
Notifications
You must be signed in to change notification settings - Fork 274
Closed
Labels
Description
Page https://redis.io/docs/latest/commands/bitpos/
reference to the examples:
redis> SET mykey "\xff\xf0\x00"
"OK"
redis> BITPOS mykey 0
(integer) 0
redis> SET mykey "\x00\xff\xf0"
"OK"
redis> BITPOS mykey 1 0
(integer) 1
redis> BITPOS mykey 1 2
(integer) 18
redis> BITPOS mykey 1 2 -1 BYTE
(integer) 18
redis> BITPOS mykey 1 7 15 BIT
(integer) 9
redis> set mykey "\x00\x00\x00"
"OK"
redis> BITPOS mykey 1
(integer) 1
redis> BITPOS mykey 1 7 -3 BIT
(integer) 9
redis>
however, actual and correct result should be (run on redis 7)
redis> SET mykey "\xff\xf0\x00"
OK
redis> BITPOS mykey 0
(integer) 12
redis> SET mykey "\x00\xff\xf0"
OK
redis> BITPOS mykey 1 0
(integer) 8
redis> BITPOS mykey 1 2
(integer) 16
redis> BITPOS mykey 1 2 -1 BYTE
(integer) 16
redis> BITPOS mykey 1 7 15 BIT
(integer) 8
redis> set mykey "\x00\x00\x00"
OK
redis> BITPOS mykey 1
(integer) -1
redis> BITPOS mykey 1 7 -3 BIT
(integer) -1
redis>
dwdougherty