If your varint is < 128, it will only take a single byte to get
encoded. Even if it's declared as an int64. (Also, consider that what
matters isn't data size but number of frames sent.)

Anyways, if you wanted to created fixed 8- and 16-bit types, you'd
have to add new field types for those, and pipe through the new types
everywhere. Just grep for FIXED32 and Uint32. However you really
should consider just using one of the varint-encoded types -- they
will likely serve you better.

  -ilia

On Tue, May 24, 2016 at 12:24 PM, Douglas Lewis <douglaslew...@gmail.com> wrote:
> Well the solution we want to implement is with 16 bit and 8 bit elements
> when that is all the resolution of the integer variable we need.  This is an
> embedded application and we are sending the messages over a wireless
> connection so data packet size is critical to achieving our desired
> throughput.
>
> - Doug
>
> On Tuesday, May 24, 2016 at 10:06:50 AM UTC-5, Douglas Lewis wrote:
>>
>> I'm working on a project and we are hoping to use protocol buffers for
>> messages between embedded and PC based applications.
>>
>> One issue I've immediately run into is protocol buffers only has 32 and 64
>> bit integers, I'm needing 16 and 8 bit integers for fields in the messages.
>> Has anyone been able to successfully add integer types to protocol buffers?
>> We are using C++ on the embedded side and Java on the PC side.
>>
>> Thanks,
>> Doug
>>
> --
> 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 https://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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to