| 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 <stddef.h> | 11 #include <stddef.h> |
| 12 #include <stdint.h> | 12 #include <stdint.h> |
| 13 #include <string.h> |
| 13 | 14 |
| 14 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 | 17 |
| 17 namespace courgette { | 18 namespace courgette { |
| 18 | 19 |
| 19 // Our difference measure is the number of k-tuples that occur in Subject that | 20 // Our difference measure is the number of k-tuples that occur in Subject that |
| 20 // don't occur in Base. | 21 // don't occur in Base. |
| 21 const int kTupleSize = 4; | 22 const int kTupleSize = 4; |
| 22 | 23 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 if (mismatches == 0) { | 120 if (mismatches == 0) { |
| 120 if (RegionsEqual(base->region(), subject->region())) | 121 if (RegionsEqual(base->region(), subject->region())) |
| 121 return 0; | 122 return 0; |
| 122 } | 123 } |
| 123 ++mismatches; // Guarantee not zero. | 124 ++mismatches; // Guarantee not zero. |
| 124 return mismatches; | 125 return mismatches; |
| 125 } | 126 } |
| 126 | 127 |
| 127 } // namespace | 128 } // namespace |
| OLD | NEW |