Created
October 17, 2018 11:33
-
-
Save jamesmintram/4357ad7fa57b5afe769ee920537444a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Result* GetExistingRouteChunk<Count>(batchStart, start, end) | |
{ | |
bool results[Count]; | |
bool found = false; | |
for ( int r = 0; r < Count; r++) | |
{ | |
const bool isActive = bActive[batchStart + r] | |
//I am assuming isActive == false means pr is still OK to read | |
const *pr = &Routes[batchStart + r]; | |
const bool pstartEq = pr->Pstart == pstart; | |
const bool pendEq = pr->Pend == pend; | |
const bool pending = pr->Type == Pending; | |
// Any conditions false means result becomes false | |
const bool result = isActive & pstartEq & pendEq & pending; | |
results[r] = result; | |
found |= result; | |
} | |
//Early exit on all batches which have no match | |
if (result == false) return null; | |
// We only run this loop in the batch that has a match | |
for ( int r = 0; r < Count; r++) | |
{ | |
if (results[r]) return &Routes[batchStart + r]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment