OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "courgette/adjustment_method.h" | 5 #include "courgette/adjustment_method.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 h += v; | 640 h += v; |
641 return (h * (37 + 0x0000d100)) ^ (h >> 13); | 641 return (h * (37 + 0x0000d100)) ^ (h >> 13); |
642 } | 642 } |
643 | 643 |
644 ShinglePattern::Index::Index(const Shingle* instance) { | 644 ShinglePattern::Index::Index(const Shingle* instance) { |
645 uint32 hash = 0; | 645 uint32 hash = 0; |
646 variables_ = 0; | 646 variables_ = 0; |
647 unique_variables_ = 0; | 647 unique_variables_ = 0; |
648 first_variable_index_ = 255; | 648 first_variable_index_ = 255; |
649 | 649 |
650 for (uint32 i = 0; i < Shingle::kWidth; ++i) { | 650 for (uint8 i = 0; i < Shingle::kWidth; ++i) { |
651 LabelInfo* info = instance->at(i); | 651 LabelInfo* info = instance->at(i); |
652 uint32 kind = 0; | 652 uint8 kind = 0; |
Peter Kasting
2014/09/30 00:08:01
Changed this because it's going to be stored back
dgarrett
2014/10/01 20:49:37
Seems like Shingle::kWidth should also be updated
Peter Kasting
2014/10/01 22:12:05
It just involves touching more code, but you're ri
| |
653 int code = -1; | 653 int code = -1; |
654 size_t j = 0; | 654 uint8 j = 0; |
655 for ( ; j < i; ++j) { | 655 for ( ; j < i; ++j) { |
656 if (info == instance->at(j)) { // Duplicate LabelInfo | 656 if (info == instance->at(j)) { // Duplicate LabelInfo |
657 kind = kinds_[j]; | 657 kind = kinds_[j]; |
658 break; | 658 break; |
659 } | 659 } |
660 } | 660 } |
661 if (j == i) { // Not found above. | 661 if (j == i) { // Not found above. |
662 if (info->assignment_) { | 662 if (info->assignment_) { |
663 code = info->label_->index_; | 663 code = info->label_->index_; |
664 assigned_indexes_[i] = code; | 664 assigned_indexes_[i] = code; |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1290 | 1290 |
1291 //////////////////////////////////////////////////////////////////////////////// | 1291 //////////////////////////////////////////////////////////////////////////////// |
1292 | 1292 |
1293 } // namespace adjustment_method_2 | 1293 } // namespace adjustment_method_2 |
1294 | 1294 |
1295 AdjustmentMethod* AdjustmentMethod::MakeShingleAdjustmentMethod() { | 1295 AdjustmentMethod* AdjustmentMethod::MakeShingleAdjustmentMethod() { |
1296 return new adjustment_method_2::Adjuster(); | 1296 return new adjustment_method_2::Adjuster(); |
1297 } | 1297 } |
1298 | 1298 |
1299 } // namespace courgette | 1299 } // namespace courgette |
OLD | NEW |