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 #include "chrome/browser/net/bit_stream_reader.h" | 5 #include "components/packed_ct_ev_whitelist/bit_stream_reader.h" |
6 | 6 |
7 #include "base/big_endian.h" | 7 #include "base/big_endian.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 | 10 |
| 11 namespace packed_ct_ev_whitelist { |
11 namespace internal { | 12 namespace internal { |
12 | 13 |
13 BitStreamReader::BitStreamReader(const base::StringPiece& source) | 14 BitStreamReader::BitStreamReader(const base::StringPiece& source) |
14 : source_(source), current_byte_(0), current_bit_(7) { | 15 : source_(source), current_byte_(0), current_bit_(7) { |
15 DCHECK_LT(source_.length(), UINT32_MAX); | 16 DCHECK_LT(source_.length(), UINT32_MAX); |
16 } | 17 } |
17 | 18 |
18 bool BitStreamReader::ReadUnaryEncoding(uint64_t* out) { | 19 bool BitStreamReader::ReadUnaryEncoding(uint64_t* out) { |
19 if (BitsLeft() == 0) | 20 if (BitsLeft() == 0) |
20 return false; | 21 return false; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 current_bit_--; | 55 current_bit_--; |
55 if (current_bit_ < 0) { | 56 if (current_bit_ < 0) { |
56 current_byte_++; | 57 current_byte_++; |
57 current_bit_ = 7; | 58 current_bit_ = 7; |
58 } | 59 } |
59 | 60 |
60 return res; | 61 return res; |
61 } | 62 } |
62 | 63 |
63 } // namespace internal | 64 } // namespace internal |
| 65 } // namespace packed_ct_ev_whitelist |
OLD | NEW |