Now that is amusing (to me, at least); I decode a variant in "calc", and
then mess up the field number! It is the field with *binary* 101, i.e. field
5.

and note also that I'm treating that as an unsigned variant; a signed
(zig/zag) variant would give a different answer.

On 19 April 2010 15:57, Marc Gravell <marc.grav...@gmail.com> wrote:

> and you process the last 2 bytes separately, of course; it is field 101 of
> type string (or sub-message or bytes), length 14, with the actual data
> missing.
>
> Marc
>
>
> On 19 April 2010 15:53, Marc Gravell <marc.grav...@gmail.com> wrote:
>
>> I know it wasn't the core part of the question, but note that BitConverter
>> isn't especially helpful for protobuf, unless you happen to be dealing with
>> [s]fixed{32|64} / float / double (it is unclear whether you mean "uint64" as
>> a protobuf type or a language-specific type).
>>
>> Treating it as fixed/unsigned I get: 1453014483955211943
>>
>> Treat it as a variant, though, and you get:
>>
>> (handle continue bits)
>>             0100100 1111001 0001001 0100101 1011110 0100111
>> (normalize)
>>             01 00100111 10010001 00101001 01101111 00100111
>>
>> = 1269450764071
>>
>> Marc
>>
>>
>> On 19 April 2010 15:34, ikalbeniz <txup...@gmail.com> wrote:
>>
>>> here some test i have been doing with c#:
>>>
>>>            byte[] data2byte = new byte[8];
>>>            data2byte[0] = (byte)167;
>>>            data2byte[1] = (byte)222;
>>>            data2byte[2] = (byte)165;
>>>            data2byte[3] = (byte)137;
>>>            data2byte[4] = (byte)249;
>>>            data2byte[5] = (byte)36;
>>>            data2byte[6] = (byte)42;
>>>            data2byte[7] = (byte)20;
>>>            Console.WriteLine(BitConverter.ToString(data2byte));
>>>            Console.WriteLine(BitConverter.ToUInt64(data2byte,0));
>>>            Console.WriteLine(BitConverter.ToUInt32(data2byte, 0));
>>>            Console.WriteLine(BitConverter.ToInt64(data2byte, 0));
>>>            Console.WriteLine(BitConverter.ToInt32(data2byte, 0));
>>>            UInt64 result = 1269450764071;
>>>            byte[] resultbyte = BitConverter.GetBytes(result);
>>>            Console.WriteLine(BitConverter.ToString(resultbyte));
>>>
>>>
>>> On 19 abr, 16:31, ikalbeniz <txup...@gmail.com> wrote:
>>> > Hi,
>>> >
>>> > I am developing a custom (and more simple) protobuff class for php.
>>> > The problem I have is with date format that is stored as uint64. For
>>> > example in a stream I have get from google Iknow that the “creation
>>> > time” is satored in a bytearray with A7-DE-A5-89-F9-24-2A-14 if I
>>> > convert this to uint64 I get this number 1453014483955211943 but I
>>> > know (using java appi) that the result is 1269450764071.
>>> >
>>> > I do not know how de conversion has been done and if it is posible to
>>> > do this in php.
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups "Protocol Buffers" group.
>>> > To post to this group, send email to proto...@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
>>> .
>>> > For more options, visit this group athttp://
>>> groups.google.com/group/protobuf?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Protocol Buffers" group.
>>> To post to this group, send email to proto...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/protobuf?hl=en.
>>>
>>>
>>
>>
>> --
>> Regards,
>>
>> Marc
>>
>
>
>
> --
> Regards,
>
> Marc
>



-- 
Regards,

Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to