• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Test the integer size overriding in nanopb options.
2 * This allows to use 8- and 16-bit integer variables, which are not supported
3 * directly by Google Protobuf.
4 *
5 * The int_size setting will override the number of bits, but keep the type
6 * otherwise. E.g. uint32 + IS_8 => uint8_t
7 */
8
9syntax = "proto2";
10
11import 'nanopb.proto';
12
13message IntSizes {
14    required int32  req_int8 =   1  [(nanopb).int_size = IS_8];
15    required uint32 req_uint8 =  2  [(nanopb).int_size = IS_8];
16    required sint32 req_sint8 =  3  [(nanopb).int_size = IS_8];
17    required int32  req_int16 =  4  [(nanopb).int_size = IS_16];
18    required uint32 req_uint16 = 5  [(nanopb).int_size = IS_16];
19    required sint32 req_sint16 = 6  [(nanopb).int_size = IS_16];
20    required int32  req_int32 =  7  [(nanopb).int_size = IS_32];
21    required uint32 req_uint32 = 8  [(nanopb).int_size = IS_32];
22    required sint32 req_sint32 = 9  [(nanopb).int_size = IS_32];
23    required int32  req_int64 =  10 [(nanopb).int_size = IS_64];
24    required uint32 req_uint64 = 11 [(nanopb).int_size = IS_64];
25    required sint32 req_sint64 = 12 [(nanopb).int_size = IS_64];
26}
27
28message DefaultSizes {
29    required int32  req_int8 =   1 ;
30    required uint32 req_uint8 =  2 ;
31    required sint32 req_sint8 =  3 ;
32    required int32  req_int16 =  4 ;
33    required uint32 req_uint16 = 5 ;
34    required sint32 req_sint16 = 6 ;
35    required int32  req_int32 =  7 ;
36    required uint32 req_uint32 = 8 ;
37    required sint32 req_sint32 = 9 ;
38    required int64  req_int64 =  10;
39    required uint64 req_uint64 = 11;
40    required sint64 req_sint64 = 12;
41}
42