1
0
mirror of https://github.com/fumiama/simple-protobuf.git synced 2026-06-10 11:30:26 +08:00

统一为32位

This commit is contained in:
fumiama
2021-05-18 22:42:44 +08:00
parent 2694f14433
commit 3c5ba54d40
3 changed files with 21 additions and 21 deletions

4
test.c
View File

@@ -18,9 +18,9 @@ int main() {
t.c = 0xCCDDEE;
t.d = 0xABCDEF12345678;
strcpy(t.e, "Hello world! This is a message from simple protobuf.");
uint64_t* items_len = align_struct(sizeof(struct TEST), 5, &t.a, &t.b, &t.c, &t.d, &t.e);
uint32_t* items_len = align_struct(sizeof(struct TEST), 5, &t.a, &t.b, &t.c, &t.d, &t.e);
for(int i = 0; i < 5; i++) {
printf("Item %d has aligned size %llu\n", i, items_len[i]);
printf("Item %d has aligned size %u\n", i, items_len[i]);
}
FILE* fp = fopen("test.sp", "wb");
if(fp) {