X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fvarint.h;h=2688a088819694a52baf052d1894b2c831339eef;hb=05ffab94be8da943cffb8fb30d7073ab78aef94c;hp=79952dc143eb76dd02c582397ef8b070a4bb4007;hpb=790966f9e1eb198ec8e6374d66c9211b01fd9a12;p=libucw.git diff --git a/ucw/varint.h b/ucw/varint.h index 79952dc1..2688a088 100644 --- a/ucw/varint.h +++ b/ucw/varint.h @@ -13,15 +13,15 @@ /*** * The encoding works in the following way: * - * First byte Stored values + * First byte Stored values * - * 0xxxxxxx 7 bits - * 10xxxxxx +1 byte 14 bits, value shifted by 2^7 - * 110xxxxx +2 bytes 21 bits, value shifted by 2^7+2^14 - * 1110xxxx +3 bytes 28 bits, value shifted by 2^7+2^14+2^21 + * 0xxxxxxx 7 bits + * 10xxxxxx +1 byte 14 bits, value shifted by 2^7 + * 110xxxxx +2 bytes 21 bits, value shifted by 2^7+2^14 + * 1110xxxx +3 bytes 28 bits, value shifted by 2^7+2^14+2^21 * .... - * 11111110 +7 bytes 56 bits, value shifted by 2^7+2^14+2^21+2^28+2^35+2^42 - * 11111111 +8 bytes full 64 bits, value shifted by 2^7+2^14+2^21+2^28+2^35+2^42+2^56 + * 11111110 +7 bytes 56 bits, value shifted by 2^7+2^14+2^21+2^28+2^35+2^42 + * 11111111 +8 bytes full 64 bits, value shifted by 2^7+2^14+2^21+2^28+2^35+2^42+2^56 * * The values are stored in bigendian to allow lexicographic sorting. * The encoding and algorithms are aimed to be optimised for storing shorter numbers.