HEADER_MAGIC |
= |
[0x8eade801, 0x00000000].pack("NN") |
|
Ruby 2 forces all strings to be UTF-8, so "\x01" becomes
"\u0001" which is two bytes 00 01 which is not what we want. I
can‘t find a sane way to create a string without this madness in Ruby
2, so let‘s just pack two 4-byte integers and go about our day.
|
HEADER_MAGIC |
= |
"\x8e\xad\xe8\x01\x00\x00\x00\x00" |
HEADER_HEADER_LENGTH |
= |
HEADER_MAGIC.length + 4 + 4 |
|
magic + index_count + data_length
|
HEADER_MAGIC |
= |
[0x8eade801, 0x00000000].pack("NN") |
|
Ruby 2 forces all strings to be UTF-8, so "\x01" becomes
"\u0001" which is two bytes 00 01 which is not what we want. I
can‘t find a sane way to create a string without this madness in Ruby
2, so let‘s just pack two 4-byte integers and go about our day.
|
HEADER_MAGIC |
= |
"\x8e\xad\xe8\x01\x00\x00\x00\x00" |
HEADER_HEADER_LENGTH |
= |
HEADER_MAGIC.length + 4 + 4 |
|
magic + index_count + data_length
|