Micro-optimisation: Merge append_byte_to_buffer with append_to_buffer

This makes the cborencoder.o only 986 bytes with -Os on x86-64. The
function is still inlined with -O2.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Thiago Macieira
2015-09-29 18:50:27 -07:00
parent c9a9cffc38
commit 618d2f1d51
+1 -12
View File
@@ -106,18 +106,7 @@ static inline CborError append_to_buffer(CborEncoder *encoder, const void *data,
static inline CborError append_byte_to_buffer(CborEncoder *encoder, uint8_t byte)
{
if (would_overflow(encoder, 1)) {
if (encoder->end != NULL) {
encoder->end = NULL;
encoder->bytes_needed = 0;
}
advance_ptr(encoder, 1);
return CborErrorOutOfMemory;
}
*encoder->ptr++ = byte;
return CborNoError;
return append_to_buffer(encoder, &byte, 1);
}
static inline CborError encode_number_no_update(CborEncoder *encoder, uint64_t ui, uint8_t shiftedMajorType)