mirror of
https://github.com/fumiama/simple-protobuf.git
synced 2026-06-05 00:10:24 +08:00
907 B
907 B
simple-protobuf
English | 简体中文
A simplified variant of Google's ProtoBuf.
format
A simple-protobuf file can be filled into a C struct directly, but no pointer is supported.
The sp file format is shown below.
[struct_len] + n*[[type][data_len][data]]
typeis a length-variable LE number(less than 2^57^) indicating the aligned type length of each struct item.*_lenis a length-variable LE number(less than 2^57^) indicating the length of*.datacontainsdata_lenbytes of the data.
usage
You can read test.c to find out the detailed usage.
Save a struct
1. Create items type length info array
This array has type uint64_t, which indicates the aligned length of each struct item. You should call align_struct to get that array.