Re: [protobuf] support for bit fields?

2014-05-19 Thread Henner Zeller
On 19 May 2014 17:43, cinyoung hur  wrote:

> Hello,
>
> I would like to apply bit fields.
> For example,
>
> struct{
>   unsigned int version : 1;
>   unsigned int type: 1;} status;
>
>
> OR is there other tips to handle these examples?
>

There are no bit-fields provided in the proto definition language. if you
need these kind of things because you are conscious about the size on the
wire or stored size on disk, you need to use one of the fixed32 or fixed64
types and do it yourself.

If you are worried about the size in memory, I think the code generator
already attempts to use this to compact a set of boolean values in this way
in languages that support it (not 100% sure, would need to look at the code
again).

-h


>
>  --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[protobuf] support for bit fields?

2014-05-19 Thread cinyoung hur
Hello, 

I would like to apply bit fields. 
For example,

struct{
  unsigned int version : 1;
  unsigned int type: 1;} status;


OR is there other tips to handle these examples?


-- 
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.
For more options, visit https://groups.google.com/d/optout.