From dc2f14d7f95e6a7170d1048eee5fd8765f94e423 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 20 Apr 2012 12:34:25 -0700 Subject: usrp2: cleanup for fifo control wraparound_lt16 routine --- host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp index 78e691ae9..3b8d215f5 100644 --- a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp +++ b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp @@ -202,11 +202,9 @@ private: } UHD_INLINE bool wraparound_lt16(const boost::int16_t i0, const boost::int16_t i1){ - if (i0 == i1) return false; - const int s0 = boost::uint16_t(i0) >> 15; - const int s1 = boost::uint16_t(i1) >> 15; - if (s0 != s1) return boost::int16_t(i1 - i0) > 0; - return boost::uint16_t(i0) < boost::uint16_t(i1); + if (((i0 ^ i1) & 0x8000) == 0) //same sign bits + return boost::uint16_t(i0) < boost::uint16_t(i1); + return boost::int16_t(i1 - i0) > 0; } UHD_INLINE boost::uint32_t wait_for_ack(const boost::uint16_t seq_to_ack){ -- cgit v1.2.3