On Monday, February 27, 2017 at 12:48:53 PM UTC-6, howar...@gmail.com wrote:
>
> You are missing that it is encoding. Specifically, using VarInt is asking 
> for Variable integer encoding: 
> https://developers.google.com/protocol-buffers/docs/encoding#varints
>
> The important bit here is that the Varint stores 7-bits of data and 1-bit 
> of metadata in each byte (the metadata being whether there are more bits). 
> Have a look at the value you stored, 1488220019858895600. In binary, that 
> is 1 0100 1010 0111 0011 1000 0011 1001 0001 1111 0101 0000 0111 0010 1111 
> 0000, which takes 61 bits. Using 7 bits per byte, this takes 8.7.... bytes 
> to store, in other words, long enough that it takes 9 bytes because the 
> encoding does not use partial by
>

This is actually really interesting, thanks a lot! 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to