OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NET_BIT_STREAM_READER_H_ | 5 #ifndef COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ |
6 #define CHROME_BROWSER_NET_BIT_STREAM_READER_H_ | 6 #define COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 | 11 |
| 12 namespace packed_ct_ev_whitelist { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 // A class for reading individual bits from a packed buffer. Bits are read | 15 // A class for reading individual bits from a packed buffer. Bits are read |
15 // MSB-first from the stream. | 16 // MSB-first from the stream. |
16 // It is limited to 64-bit reads, 4GB streams and is inefficient as a design | 17 // It is limited to 64-bit reads, 4GB streams and is inefficient as a design |
17 // choice. This class should not be used frequently. | 18 // choice. This class should not be used frequently. |
18 // | 19 // |
19 // It is meant for data that is is packed across bytes, necessitating the need | 20 // It is meant for data that is is packed across bytes, necessitating the need |
20 // to read a variable number of bits across a byte boundary. | 21 // to read a variable number of bits across a byte boundary. |
21 class BitStreamReader { | 22 class BitStreamReader { |
(...skipping 25 matching lines...) Expand all Loading... |
47 | 48 |
48 // Index of the last bit read within |current_byte_|. Since bits are read | 49 // Index of the last bit read within |current_byte_|. Since bits are read |
49 // from the MSB to the LSB, this value is initialized to 7 and decremented | 50 // from the MSB to the LSB, this value is initialized to 7 and decremented |
50 // after each read. | 51 // after each read. |
51 int8 current_bit_; | 52 int8 current_bit_; |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(BitStreamReader); | 54 DISALLOW_COPY_AND_ASSIGN(BitStreamReader); |
54 }; | 55 }; |
55 | 56 |
56 } // namespace internal | 57 } // namespace internal |
| 58 } // namespace packed_ct_ev_whitelist |
57 | 59 |
58 #endif // CHROME_BROWSER_NET_BIT_STREAM_READER_H_ | 60 #endif // COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ |
OLD | NEW |