Coding style

This commit is contained in:
Davide Berardi 2021-01-24 19:06:43 +01:00
parent c38cf21375
commit 1fb3fa4de8
1 changed files with 3 additions and 4 deletions

View File

@ -38,11 +38,10 @@
#define prerror(f...) fprintf(stderr, "[ ERROR ]"), fprintf(stderr, f) #define prerror(f...) fprintf(stderr, "[ ERROR ]"), fprintf(stderr, f)
/* Logarithm base two of the number */ /* Logarithm base two of the number */
static uint32_t log2_32(uint32_t n) static uint32_t log2_32(uint32_t n) {
{
int32_t i = 0; int32_t i = 0;
for (i = 31; i >= 0; --i) { for (i = 31; i >= 0; --i) {
if (n & (1ul<<i)) if (n & (1ul << i))
return i + 1; return i + 1;
} }
return 0; return 0;
@ -68,7 +67,7 @@ static uint32_t get_length(uint8_t *data, uint32_t length, uint32_t *bytes) {
while (cbit != 0) { while (cbit != 0) {
c = *data; c = *data;
/* Return error */ /* Return error */
if (check_overflow_shift(c, shift, length)) if (check_overflow_shift(c, shift, length))
return MAX_UNCOMPRESSED_DATA_SIZE + 1; return MAX_UNCOMPRESSED_DATA_SIZE + 1;