summaryrefslogtreecommitdiffstats
path: root/courgette/adjustment_method_2.cc
diff options
context:
space:
mode:
authorsra@google.com <sra@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-18 03:28:40 +0000
committersra@google.com <sra@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-18 03:28:40 +0000
commit54f1b829fe53c48b82440e7c8482e2b6ca397995 (patch)
tree5600358a8d8fac77ea4a7730fca9c4b6cbe09108 /courgette/adjustment_method_2.cc
parent4efe77c3fd39df0dc03b0d73ca0ba24c6e66ff28 (diff)
downloadchromium_src-54f1b829fe53c48b82440e7c8482e2b6ca397995.zip
chromium_src-54f1b829fe53c48b82440e7c8482e2b6ca397995.tar.gz
chromium_src-54f1b829fe53c48b82440e7c8482e2b6ca397995.tar.bz2
Code changes to get the code to compile under GCC.
Courgette still only knows how to compress Windows x86 executables. But now you can compress them on linux. BUG=none TEST=none Review URL: http://codereview.chromium.org/149597 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/adjustment_method_2.cc')
-rw-r--r--courgette/adjustment_method_2.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/courgette/adjustment_method_2.cc b/courgette/adjustment_method_2.cc
index 17868ba..976dfc9 100644
--- a/courgette/adjustment_method_2.cc
+++ b/courgette/adjustment_method_2.cc
@@ -208,7 +208,7 @@ class LabelInfo {
// output. The pair (is_model_, debug_index_) is
// unique.
- uint32 refs_; // Number of times this Label is referenced.
+ int refs_; // Number of times this Label is referenced.
LabelInfo* assignment_; // Label from other program corresponding to this.
@@ -403,10 +403,14 @@ class Shingle {
OwningSet* owning_set) {
std::pair<OwningSet::iterator, bool> pair =
owning_set->insert(Shingle(trace, position));
- // pair.first is the newly inserted Shingle or the previouly inserted one
- // that looks the same according to the comparator.
- pair.first->add_position(position);
- return &*pair.first;
+ // pair.first iterator 'points' to the newly inserted Shingle or the
+ // previouly inserted one that looks the same according to the comparator.
+
+ // const_cast required because key is const. We modify the Shingle
+ // extensively but not in a way that affects InterningLess.
+ Shingle* shingle = const_cast<Shingle*>(&*pair.first);
+ shingle->add_position(position);
+ return shingle;
}
LabelInfo* at(size_t i) const { return trace_[exemplar_position_ + i]; }
@@ -957,7 +961,8 @@ class AssignmentProblem {
for (Shingle::OwningSet::iterator p = shingle_instances_.begin();
p != shingle_instances_.end();
++p) {
- Reclassify(&*p);
+ // GCC's set<T>::iterator::operator *() returns a const object.
+ Reclassify(const_cast<Shingle*>(&*p));
}
}
@@ -1035,8 +1040,6 @@ class AssignmentProblem {
void AddPatternToLabelQueue(const ShinglePattern* pattern, int sign) {
// For each possible assignment in this pattern, update the potential
// contributions to the LabelInfo queues.
- size_t model_histogram_size = pattern->model_histogram_.size();
- size_t program_histogram_size = pattern->program_histogram_.size();
// We want to find for each symbol (LabelInfo) the maximum contribution that
// could be achieved by making shingle-wise assignments between shingles in
@@ -1053,7 +1056,7 @@ class AssignmentProblem {
// assignments are blocked by previous incompatible assignments. We want to
// avoid a combinatorial search, so we ignore the blocking.
- const int kUnwieldy = 5;
+ const size_t kUnwieldy = 5;
typedef std::map<LabelInfo*, int> LabelToScore;
typedef std::map<LabelInfo*, LabelToScore > ScoreSet;