Shichiro is kinda XML-based linear binary encoding for integers developed by me. More optimized and flexible modification of NANAKO encoding.
Shichiro is a Japanese male name that contains Japanese word 七 (nana or shichi) which means "seven".
Firstly, we translate the number into binary and count its length in binary digits or bits. If the length is less than 128, it is being encoded straightly as one byte (e.g. 10 => 00001010
). Otherwise, it is being encoded using NANAKO encoding (e.g. 192 => 11100000 00000000 00000001
).
Finally, we just write the binary representation of the number bitwisely (NOT bytewisely!).
Examples:
- 1089 =>
00001011 10001000001
- 2^126 + 1 =>
01111111 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
- 2^127 + 1 =>
11000000 00000000 00000001 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001