/** * Get the sorted order of indices (the indices of the insertion of items, * sorted according to the values of the items). * * The returned list will contain the indices of the inserted items in an * order such that the original items will be from large value to smaller value. */ std::list<int> SortHelper::getSortedOrderInList() const { std::list<int> orderList(size(), 0); std::list<int>::iterator orderIter; std::list<ListItem>::const_iterator itemsIter; for (orderIter = orderList.begin(), itemsIter = _list.begin(); itemsIter != _list.end(); orderIter++, itemsIter++) { *orderIter = itemsIter->_originalIndex; } return orderList; }
bool ProcessList::advanceTime(SimTime timeDelta) { PROFILE_START(ProcessList_AdvanceTime); // some drivers change the FPU control state, which will break our control object simulation // (leading to packet mismatch errors due to small FP differences). So set it to the known // state before advancing. // TODO: revisit this. //U32 mathState = Platform::getMathControlState(); //Platform::setMathControlStateKnown(); if (mDirty) orderList(); SimTime targetTime = mLastTime + timeDelta; SimTime targetTick = targetTime - (targetTime % TickMs); SimTime tickDelta = targetTick - mLastTick; bool tickPass = mLastTick != targetTick; if ( tickPass ) mPreTick.trigger(); // Advance all the objects. for (; mLastTick != targetTick; mLastTick += TickMs) onAdvanceObjects(); mLastTime = targetTime; mLastDelta = ((TickMs - ((targetTime+1) % TickMs)) % TickMs) / F32(TickMs); if ( tickPass ) mPostTick.trigger( tickDelta ); // restore math control state in case others are relying on it being a certain value // TODO: revisit this. //Platform::setMathControlState(mathState); PROFILE_END(); return tickPass; }