OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "net/quic/crypto/strike_register.h" | 5 #include "net/quic/crypto/strike_register.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 using std::pair; | 9 using std::pair; |
10 using std::set; | 10 using std::set; |
11 using std::vector; | 11 using std::vector; |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 // static | 15 // static |
16 const uint32 StrikeRegister::kExternalNodeSize = 24; | 16 const uint32 StrikeRegister::kExternalNodeSize = 24; |
17 // static | 17 // static |
18 const uint32 StrikeRegister::kNil = (1 << 31) | 1; | 18 const uint32 StrikeRegister::kNil = 0x80000001; |
Ryan Hamilton
2014/07/08 03:37:08
Out of curiosity, why this change?
Peter Kasting
2014/07/08 06:26:46
1 << 31 is a (negative) signed value (because 1 is
Ryan Hamilton
2014/07/08 18:00:57
AH. In that case, how about 1u << 31? (We end up
Peter Kasting
2014/07/08 18:16:46
That would certainly compile without error. I per
Ryan Hamilton
2014/07/08 18:24:01
Personally, I'd prefer 1u << 31 because when I see
Peter Kasting
2014/07/08 18:44:45
Changed.
| |
19 // static | 19 // static |
20 const uint32 StrikeRegister::kExternalFlag = 1 << 23; | 20 const uint32 StrikeRegister::kExternalFlag = 1 << 23; |
21 | 21 |
22 // InternalNode represents a non-leaf node in the critbit tree. See the comment | 22 // InternalNode represents a non-leaf node in the critbit tree. See the comment |
23 // in the .h file for details. | 23 // in the .h file for details. |
24 class StrikeRegister::InternalNode { | 24 class StrikeRegister::InternalNode { |
25 public: | 25 public: |
26 void SetChild(unsigned direction, uint32 child) { | 26 void SetChild(unsigned direction, uint32 child) { |
27 data_[direction] = (data_[direction] & 0xff) | (child << 8); | 27 data_[direction] = (data_[direction] & 0xff) | (child << 8); |
28 } | 28 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 CHECK_EQ(free_internal_nodes.count(inter), 0u); | 455 CHECK_EQ(free_internal_nodes.count(inter), 0u); |
456 CHECK_EQ(used_internal_nodes->count(inter), 0u); | 456 CHECK_EQ(used_internal_nodes->count(inter), 0u); |
457 used_internal_nodes->insert(inter); | 457 used_internal_nodes->insert(inter); |
458 ValidateTree(inter, bit, bits, free_internal_nodes, free_external_nodes, | 458 ValidateTree(inter, bit, bits, free_internal_nodes, free_external_nodes, |
459 used_internal_nodes, used_external_nodes); | 459 used_internal_nodes, used_external_nodes); |
460 } | 460 } |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 } // namespace net | 464 } // namespace net |
OLD | NEW |