Re: [protobuf] Can I use int16 instead of int32 to verify a variable?

2013-05-07 Thread Marc Gravell
On 7 May 2013 18:53, "Marc Gravell"  wrote:

> Protobuf has a fee encodings for integer data, which basically come down
> to:
>
> - varint (with or without zigzag)
> - fixed-32 (always 4 bytes)
> - fixed-64 (always 8 bytes)
>
> For 16 bits, you will do best with varint. If the data can be negative
> (signed), ensure you are using the zigzag form (sint32). But that is all
> the options.
>
> Marc
> On 7 May 2013 18:36, "王海龙"  wrote:
>
>> Hi,
>> I have a question here,
>> I want use int16 (short) to verify a variable,because int32 is too big
>> for me , I want to reduce the length of my package.
>> Is there any way to do this?
>> Thank you !
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at http://groups.google.com/group/protobuf?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>

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




Re: [protobuf] Can I use int16 instead of int32 to verify a variable?

2013-05-07 Thread Feng Xiao
On Thu, Apr 25, 2013 at 9:36 PM, 王海龙  wrote:

> Hi,
> I have a question here,
> I want use int16 (short) to verify a variable,because int32 is too big for
> me , I want to reduce the length of my package.
>
What do you mean by "the length of your package"? I believe using int16
doesn't save you any memory or decrease the wire format size.


> Is there any way to do this?
> Thank you !
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




[protobuf] Can I use int16 instead of int32 to verify a variable?

2013-05-07 Thread 王海龙
Hi,
I have a question here,
I want use int16 (short) to verify a variable,because int32 is too big for 
me , I want to reduce the length of my package.
Is there any way to do this?
Thank you !

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