Here is the documentation of listpack: listpack


The length of "hello" is 5, it's less then 63, so it matches this format

10|xxxxxx <string-data>

The first 2bit is 10, and the rest 6bit representing the length of the <string-data>, in this case, is 5(the length of "hello"),5 convert to binary code is 101, we use 000 the make it reach 6bit, so it should be 000101, 10 concat 000101 is 10000101, convert it to hex is 0x85 not 0x45, so am I wrong? or you make a mistake? Redis [QUESTION] why string

Comment From: sundb

@xiebruce Thanks, This is a mistake, it should be 85. "\x40" -- The empty string should be "\x80" -- The empty string

Comment From: oranagra

i see you opened https://github.com/antirez/listpack/issues/2 thanks.

Comment From: xiebruce

@xiebruce Thanks, This is a mistake, it should be 85. "\x40" -- The empty string should be "\x80" -- The empty string

u r welcome. since it is a mistake, I think it should be corrected, I've send a pull request.

Comment From: xiebruce

i see you opened antirez/listpack#2 thanks.

Yes, but it seems few people pay attention to that repository, so I reopen it here.