[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grob.cc: rewrite O(n^2) algorithm in Grob::common_refpoint algorithm to
From: |
joeneeman |
Subject: |
grob.cc: rewrite O(n^2) algorithm in Grob::common_refpoint algorithm to O(n) (issue 5371050) |
Date: |
Thu, 10 Nov 2011 16:41:54 +0000 |
http://codereview.appspot.com/5371050/diff/1/lily/grob.cc
File lily/grob.cc (right):
http://codereview.appspot.com/5371050/diff/1/lily/grob.cc#newcode536
lily/grob.cc:536: c = c->dim_cache_[a].parent_;
After this loop, balance will be 0, right? So the next loop won't do
anything...
http://codereview.appspot.com/5371050/diff/1/lily/grob.cc#newcode542
lily/grob.cc:542: while (c != d) {
{ on new line
http://codereview.appspot.com/5371050/diff/1/lily/grob.cc#newcode542
lily/grob.cc:542: while (c != d) {
The old version would return 0 if there was no common refpoint (which is
possible if the grob hierarchy hasn't been fully built yet). I'd suggest
a "while (c && c != d)" to keep the old behavior.
http://codereview.appspot.com/5371050/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- grob.cc: rewrite O(n^2) algorithm in Grob::common_refpoint algorithm to O(n) (issue 5371050),
joeneeman <=