mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
|
|
/*----------------------------------------------------------------------------*/
|
||
|
|
/* Copyright (c) FIRST 2015. All Rights Reserved. */
|
||
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||
|
|
/* the project. */
|
||
|
|
/*----------------------------------------------------------------------------*/
|
||
|
|
|
||
|
|
#include "nt_seqnum.h"
|
||
|
|
|
||
|
|
namespace NtImpl {
|
||
|
|
|
||
|
|
bool operator< (const SequenceNumber &lhs, const SequenceNumber &rhs)
|
||
|
|
{
|
||
|
|
if (lhs.m_val < rhs.m_val)
|
||
|
|
return (rhs.m_val - lhs.m_val) < (1u<<15);
|
||
|
|
else if (lhs.m_val > rhs.m_val)
|
||
|
|
return (lhs.m_val - rhs.m_val) > (1u<<15);
|
||
|
|
else
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
bool operator> (const SequenceNumber &lhs, const SequenceNumber &rhs)
|
||
|
|
{
|
||
|
|
if (lhs.m_val < rhs.m_val)
|
||
|
|
return (rhs.m_val - lhs.m_val) > (1u<<15);
|
||
|
|
else if (lhs.m_val > rhs.m_val)
|
||
|
|
return (lhs.m_val - rhs.m_val) < (1u<<15);
|
||
|
|
else
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace NtImpl
|