コード例 #1
0
ファイル: Timer.cpp プロジェクト: flwh/Alcatel_OT_985_kernel
inline bool operator<(const TimerHeapElement& a, const TimerHeapElement& b)
{
    // The comparisons below are "backwards" because the heap puts the largest 
    // element first and we want the lowest time to be the first one in the heap.
    double aFireTime = a.timer()->m_nextFireTime;
    double bFireTime = b.timer()->m_nextFireTime;
    if (bFireTime != aFireTime)
        return bFireTime < aFireTime;
    
    // We need to look at the difference of the insertion orders instead of comparing the two 
    // outright in case of overflow. 
    unsigned difference = a.timer()->m_heapInsertionOrder - b.timer()->m_heapInsertionOrder;
    return difference < UINT_MAX / 2;
}
コード例 #2
0
ファイル: Timer.cpp プロジェクト: flwh/Alcatel_OT_985_kernel
inline TimerHeapElement::TimerHeapElement(const TimerHeapElement& o)
    : m_index(-1), m_timer(o.timer())
{
}
コード例 #3
0
ファイル: Timer.cpp プロジェクト: Crawping/davinci
inline bool operator<(const TimerHeapElement& a, const TimerHeapElement& b)
{
    // Note, this is "backwards" because the heap puts the largest element first
    // and we want the lowest time to be the first one in the heap.
    return b.timer()->m_nextFireTime < a.timer()->m_nextFireTime;
}