| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 CHECK_EQ(free_internal_nodes.count(internal_node), 0u); | 489 CHECK_EQ(free_internal_nodes.count(internal_node), 0u); |
| 490 | 490 |
| 491 for (unsigned child = 0; child < 2; child++) { | 491 for (unsigned child = 0; child < 2; child++) { |
| 492 if (i->child(child) & kExternalFlag) { | 492 if (i->child(child) & kExternalFlag) { |
| 493 uint32 ext = i->child(child) & ~kExternalFlag; | 493 uint32 ext = i->child(child) & ~kExternalFlag; |
| 494 CHECK_EQ(free_external_nodes.count(ext), 0u); | 494 CHECK_EQ(free_external_nodes.count(ext), 0u); |
| 495 CHECK_EQ(used_external_nodes->count(ext), 0u); | 495 CHECK_EQ(used_external_nodes->count(ext), 0u); |
| 496 used_external_nodes->insert(ext); | 496 used_external_nodes->insert(ext); |
| 497 const uint8* bytes = external_node(ext); | 497 const uint8* bytes = external_node(ext); |
| 498 for (vector<pair<unsigned, bool>>::const_iterator j = bits.begin(); | 498 for (const pair<unsigned, bool>& pair : bits) { |
| 499 j != bits.end(); j++) { | 499 unsigned byte = pair.first / 8; |
| 500 unsigned byte = j->first / 8; | |
| 501 DCHECK_LE(byte, 0xffu); | 500 DCHECK_LE(byte, 0xffu); |
| 502 unsigned new_bit = j->first % 8; | 501 unsigned bit_new = pair.first % 8; |
| 503 static const uint8 kMasks[8] = | 502 static const uint8 kMasks[8] = |
| 504 {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; | 503 {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; |
| 505 CHECK_EQ((bytes[byte] & kMasks[new_bit]) != 0, j->second); | 504 CHECK_EQ((bytes[byte] & kMasks[bit_new]) != 0, pair.second); |
| 506 } | 505 } |
| 507 } else { | 506 } else { |
| 508 uint32 inter = i->child(child); | 507 uint32 inter = i->child(child); |
| 509 vector<pair<unsigned, bool> > new_bits(bits); | 508 vector<pair<unsigned, bool> > new_bits(bits); |
| 510 new_bits.push_back(pair<unsigned, bool>(bit, child != 0)); | 509 new_bits.push_back(pair<unsigned, bool>(bit, child != 0)); |
| 511 CHECK_EQ(free_internal_nodes.count(inter), 0u); | 510 CHECK_EQ(free_internal_nodes.count(inter), 0u); |
| 512 CHECK_EQ(used_internal_nodes->count(inter), 0u); | 511 CHECK_EQ(used_internal_nodes->count(inter), 0u); |
| 513 used_internal_nodes->insert(inter); | 512 used_internal_nodes->insert(inter); |
| 514 ValidateTree(inter, bit, bits, free_internal_nodes, free_external_nodes, | 513 ValidateTree(inter, bit, bits, free_internal_nodes, free_external_nodes, |
| 515 used_internal_nodes, used_external_nodes); | 514 used_internal_nodes, used_external_nodes); |
| 516 } | 515 } |
| 517 } | 516 } |
| 518 } | 517 } |
| 519 | 518 |
| 520 } // namespace net | 519 } // namespace net |
| OLD | NEW |