diff --git a/src/ziplist.c b/src/ziplist.c index f7d7877f..684f8ccf 100644 --- a/src/ziplist.c +++ b/src/ziplist.c @@ -8,24 +8,31 @@ * * ---------------------------------------------------------------------------- * - * ZIPLIST OVERALL LAYOUT: - * The general layout of the ziplist is as follows: - * + * ZIPLIST OVERALL LAYOUT * - * is an unsigned integer to hold the number of bytes that the - * ziplist occupies. This value needs to be stored to be able to resize the + * The general layout of the ziplist is as follows: + * + * ... + * + * All fields are stored in little endian. + * + * is an unsigned integer to hold the number of bytes that + * the ziplist occupies. This value needs to be stored to be able to resize the * entire structure without the need to traverse it first. * - * is the offset to the last entry in the list. This allows a pop - * operation on the far side of the list without the need for full traversal. + * is the offset to the last entry in the list. This allows + * a pop operation on the far side of the list without the need for full + * traversal. * - * is the number of entries.When this value is larger than 2**16-2, - * we need to traverse the entire list to know how many items it holds. + * is the number of entries. When this value is larger + * than 2^16-2, we need to traverse the entire list to know how many items it + * holds. * - * is a single byte special value, equal to 255, which indicates the - * end of the list. + * is a single byte special value, equal to 255, which + * indicates the end of the list. + * + * ZIPLIST ENTRIES * - * ZIPLIST ENTRIES: * Every entry in the ziplist is prefixed by a header that contains two pieces * of information. First, the length of the previous entry is stored to be * able to traverse the list from back to front. Second, the encoding with an