Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(903)

Unified Diff: courgette/adjustment_method_2.cc

Issue 149597: Code changes to get the code to compile under GCC.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/all.gyp ('k') | courgette/assembly_program.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/adjustment_method_2.cc
===================================================================
--- courgette/adjustment_method_2.cc (revision 21002)
+++ courgette/adjustment_method_2.cc (working copy)
@@ -208,7 +208,7 @@
// 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 @@
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 @@
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 @@
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 @@
// 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;
Property changes on: courgette/adjustment_method_2.cc
___________________________________________________________________
Name: svn:eol-style
+ LF
« no previous file with comments | « build/all.gyp ('k') | courgette/assembly_program.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698