| 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 COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ | 5 #ifndef COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ |
| 6 #define COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ | 6 #define COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 8 #include <stdint.h> | 9 #include <stdint.h> |
| 9 | 10 |
| 11 #include "base/macros.h" |
| 10 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 11 | 13 |
| 12 namespace packed_ct_ev_whitelist { | 14 namespace packed_ct_ev_whitelist { |
| 13 namespace internal { | 15 namespace internal { |
| 14 | 16 |
| 15 // A class for reading individual bits from a packed buffer. Bits are read | 17 // A class for reading individual bits from a packed buffer. Bits are read |
| 16 // MSB-first from the stream. | 18 // MSB-first from the stream. |
| 17 // It is limited to 64-bit reads, 4GB streams and is inefficient as a design | 19 // It is limited to 64-bit reads, 4GB streams and is inefficient as a design |
| 18 // choice. This class should not be used frequently. | 20 // choice. This class should not be used frequently. |
| 19 // | 21 // |
| (...skipping 27 matching lines...) Expand all Loading... |
| 47 uint8_t ReadByte(); | 49 uint8_t ReadByte(); |
| 48 | 50 |
| 49 const base::StringPiece source_; | 51 const base::StringPiece source_; |
| 50 | 52 |
| 51 // Index of the byte currently being read from. | 53 // Index of the byte currently being read from. |
| 52 size_t current_byte_; | 54 size_t current_byte_; |
| 53 | 55 |
| 54 // Index of the last bit read within |current_byte_|. Since bits are read | 56 // Index of the last bit read within |current_byte_|. Since bits are read |
| 55 // from the MSB to the LSB, this value is initialized to 7 and decremented | 57 // from the MSB to the LSB, this value is initialized to 7 and decremented |
| 56 // after each read. | 58 // after each read. |
| 57 int8 current_bit_; | 59 int8_t current_bit_; |
| 58 | 60 |
| 59 DISALLOW_COPY_AND_ASSIGN(BitStreamReader); | 61 DISALLOW_COPY_AND_ASSIGN(BitStreamReader); |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 } // namespace internal | 64 } // namespace internal |
| 63 } // namespace packed_ct_ev_whitelist | 65 } // namespace packed_ct_ev_whitelist |
| 64 | 66 |
| 65 #endif // COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ | 67 #endif // COMPONENTS_PACKED_CT_EV_WHITELIST_BIT_STREAM_READER_H_ |
| OLD | NEW |