ext/encoder.c in base32-0.1.0 vs ext/encoder.c in base32-0.1.1

- old
+ new

@@ -19,24 +19,27 @@ * THE SOFTWARE. */ #include "encoder.h" -inline size_t base32_encoder_last_quintent (const size_t bytes) +inline size_t +base32_encoder_last_quintent (const size_t bytes) { int quintets = bytes * 8 / 5; int remainder = bytes % 5; return remainder == 0 ? quintets : quintets + 1; } -inline size_t base32_encoder_output_padding_size (const size_t bytes) +inline size_t +base32_encoder_output_padding_size (const size_t bytes) { unsigned remainder = bytes % 5; return remainder == 0 ? 0 : (5 - remainder) * 8 / 5; } -inline size_t base32_encoder_buffer_size (const size_t bytes) +inline size_t +base32_encoder_buffer_size (const size_t bytes) { return base32_encoder_last_quintent (bytes) + base32_encoder_output_padding_size (bytes); } @@ -82,10 +85,10 @@ return buffer[offset + 4] & 0x1F; } } -static uint8_t +static inline uint8_t base32_encoder_encode_at_position (unsigned position, const uint8_t *buffer) { const char *table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; unsigned index = base32_encoder_encode_bits (position, buffer); return table[index];