]>
iEval git - io-compress-brotli.git/blob - dec/bit_reader.c
fc814d0524e80d449cdcfe6a5c6066c499f9cb3a
1 /* Copyright 2013 Google Inc. All Rights Reserved.
3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
7 /* Bit reading helpers */
11 #include "./bit_reader.h"
14 #if defined(__cplusplus) || defined(c_plusplus)
18 void BrotliInitBitReader(BrotliBitReader
* const br
) {
20 br
->bit_pos_
= sizeof(br
->val_
) << 3;
23 int BrotliWarmupBitReader(BrotliBitReader
* const br
) {
24 size_t aligned_read_mask
= (sizeof(br
->val_
) >> 1) - 1;
25 /* Fixing alignment after unaligned BrotliFillWindow would result accumulator
26 overflow. If unalignment is caused by BrotliSafeReadBits, then there is
27 enough space in accumulator to fix aligment. */
28 if (!BROTLI_ALIGNED_READ
) {
29 aligned_read_mask
= 0;
31 if (BrotliGetAvailableBits(br
) == 0) {
32 if (!BrotliPullByte(br
)) {
37 while ((((size_t)br
->next_in
) & aligned_read_mask
) != 0) {
38 if (!BrotliPullByte(br
)) {
39 /* If we consumed all the input, we don't care about the alignment. */
46 #if defined(__cplusplus) || defined(c_plusplus)
This page took 0.043996 seconds and 3 git commands to generate.