Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 084c6fc9a925
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 83abdcce4736
Choose a head ref
  • 6 commits
  • 1 file changed
  • 1 contributor

Commits on Aug 11, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ea65e44 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f2ae43c View commit details
  3. Better comments.

    pleroy committed Aug 11, 2019
    Copy the full SHA
    938a032 View commit details
  4. Test failures in devel.

    pleroy committed Aug 11, 2019
    Copy the full SHA
    1cc8a7d View commit details
  5. More lint.

    pleroy committed Aug 11, 2019
    Copy the full SHA
    650788a View commit details
  6. Merge pull request #2279 from pleroy/2261a

     Some micro-optimizations of the trajectory iterators
    pleroy authored Aug 11, 2019
    Copy the full SHA
    83abdcc View commit details
Showing with 13 additions and 2 deletions.
  1. +13 −2 physics/forkable_body.hpp
15 changes: 13 additions & 2 deletions physics/forkable_body.hpp
Original file line number Diff line number Diff line change
@@ -22,7 +22,16 @@ template<typename Tr4jectory, typename It3rator>
bool ForkableIterator<Tr4jectory, It3rator>::operator==(
It3rator const& right) const {
DCHECK_EQ(trajectory(), right.trajectory());
// The comparison of iterators is faster than the comparison of deques, so if
// this function returns false (which it does repeatedly in loops), it might
// as well do so quickly. However, we may end up comparing iterators from
// different containers, and in debug mode this is detected as a failure.
// Trust me, I know what I am doing.
#if defined(_DEBUG)
return ancestry_ == right.ancestry_ && current_ == right.current_;
#else
return current_ == right.current_ && ancestry_ == right.ancestry_;
#endif
}

template<typename Tr4jectory, typename It3rator>
@@ -109,8 +118,10 @@ void ForkableIterator<Tr4jectory, It3rator>::NormalizeIfEnd() {

template<typename Tr4jectory, typename It3rator>
void ForkableIterator<Tr4jectory, It3rator>::CheckNormalizedIfEnd() {
CHECK(current_ != ancestry_.front()->timeline_end() ||
ancestry_.size() == 1);
// Checking if the trajectory is a root is faster than obtaining the end of
// the front of the deque, so it should be done first.
CHECK(ancestry_.size() == 1 ||
current_ != ancestry_.front()->timeline_end());
}

template<typename Tr4jectory, typename It3rator>