utils,cbor: Use uint64_t for type new_reference has code that expects the emitted field to be sometimes larger than a 32bit value so it's necessary to make the type 64 bits on 32-bit architectures. Also reordered the field in the struct to likely get slightly better packing efficiency. Signed-off-by: Kent McLeod <kent@kry10.com>
diff --git a/libutils/include/utils/cbor64.h b/libutils/include/utils/cbor64.h index 148daad..96fd002 100644 --- a/libutils/include/utils/cbor64.h +++ b/libutils/include/utils/cbor64.h
@@ -417,9 +417,9 @@ /* Tracks the strings which have already been emitted and their index. */ typedef struct { char **strings; - size_t emitted; /* Use shared values rather than string references */ bool shared_values; + uint64_t emitted; } cbor64_domain_t; /* Start a new domain with no inner string references */
diff --git a/libutils/src/cbor64.c b/libutils/src/cbor64.c index def52c4..06f54a2 100644 --- a/libutils/src/cbor64.c +++ b/libutils/src/cbor64.c
@@ -158,7 +158,7 @@ * encoding, don't actually track the string in the references. */ size_t length = strlen(domain->strings[index]); - size_t next_ref = domain->emitted; + uint64_t next_ref = domain->emitted; bool is_referenced = true; if (next_ref < 24) {