| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // We want to measure the similarity of two sequences of bytes as a surrogate | 5 // We want to measure the similarity of two sequences of bytes as a surrogate |
| 6 // for measuring how well a second sequence will compress differentially to the | 6 // for measuring how well a second sequence will compress differentially to the |
| 7 // first sequence. | 7 // first sequence. |
| 8 | 8 |
| 9 #include "courgette/difference_estimator.h" | 9 #include "courgette/difference_estimator.h" |
| 10 | 10 |
| 11 #include "base/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 | 12 |
| 13 namespace courgette { | 13 namespace courgette { |
| 14 | 14 |
| 15 // Our difference measure is the number of k-tuples that occur in Subject that | 15 // Our difference measure is the number of k-tuples that occur in Subject that |
| 16 // don't occur in Base. | 16 // don't occur in Base. |
| 17 const int kTupleSize = 4; | 17 const int kTupleSize = 4; |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 COMPILE_ASSERT(kTupleSize >= 4 && kTupleSize <= 8, kTupleSize_between_4_and_8); | 21 COMPILE_ASSERT(kTupleSize >= 4 && kTupleSize <= 8, kTupleSize_between_4_and_8); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 if (mismatches == 0) { | 110 if (mismatches == 0) { |
| 111 if (RegionsEqual(base->region(), subject->region())) | 111 if (RegionsEqual(base->region(), subject->region())) |
| 112 return 0; | 112 return 0; |
| 113 } | 113 } |
| 114 ++mismatches; // Guarantee not zero. | 114 ++mismatches; // Guarantee not zero. |
| 115 return mismatches; | 115 return mismatches; |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace | 118 } // namespace |
| OLD | NEW |