diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /contrib/libs/brotli/enc/write_bits.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/brotli/enc/write_bits.h')
-rw-r--r-- | contrib/libs/brotli/enc/write_bits.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/contrib/libs/brotli/enc/write_bits.h b/contrib/libs/brotli/enc/write_bits.h index 36515a6893..6f6080b5c0 100644 --- a/contrib/libs/brotli/enc/write_bits.h +++ b/contrib/libs/brotli/enc/write_bits.h @@ -1,23 +1,23 @@ /* Copyright 2010 Google Inc. All Rights Reserved. - + Distributed under MIT license. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ /* Write bits into a byte array. */ -#ifndef BROTLI_ENC_WRITE_BITS_H_ -#define BROTLI_ENC_WRITE_BITS_H_ - +#ifndef BROTLI_ENC_WRITE_BITS_H_ +#define BROTLI_ENC_WRITE_BITS_H_ + #include "../common/platform.h" #include <brotli/types.h> - + #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif - + /*#define BIT_WRITER_DEBUG */ - + /* This function writes bits into bytes in increasing addresses, and within a byte least-significant-bit first. @@ -50,36 +50,36 @@ static BROTLI_INLINE void BrotliWriteBits(size_t n_bits, (int)*pos)); BROTLI_DCHECK((bits >> n_bits) == 0); BROTLI_DCHECK(n_bits <= 56); - v |= bits << (*pos & 7); + v |= bits << (*pos & 7); BROTLI_UNALIGNED_STORE64LE(p, v); /* Set some bits. */ - *pos += n_bits; -#else + *pos += n_bits; +#else /* implicit & 0xFF is assumed for uint8_t arithmetics */ uint8_t* array_pos = &array[*pos >> 3]; const size_t bits_reserved_in_first_byte = (*pos & 7); size_t bits_left_to_write; - bits <<= bits_reserved_in_first_byte; + bits <<= bits_reserved_in_first_byte; *array_pos++ |= (uint8_t)bits; for (bits_left_to_write = n_bits + bits_reserved_in_first_byte; bits_left_to_write >= 9; - bits_left_to_write -= 8) { - bits >>= 8; + bits_left_to_write -= 8) { + bits >>= 8; *array_pos++ = (uint8_t)bits; - } - *array_pos = 0; - *pos += n_bits; -#endif -} - + } + *array_pos = 0; + *pos += n_bits; +#endif +} + static BROTLI_INLINE void BrotliWriteBitsPrepareStorage( size_t pos, uint8_t* array) { BROTLI_LOG(("WriteBitsPrepareStorage %10d\n", (int)pos)); BROTLI_DCHECK((pos & 7) == 0); - array[pos >> 3] = 0; -} - + array[pos >> 3] = 0; +} + #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */ #endif - + #endif /* BROTLI_ENC_WRITE_BITS_H_ */ |