aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-04-20 12:34:25 -0700
committerJosh Blum <josh@joshknows.com>2012-04-20 12:34:25 -0700
commitdc2f14d7f95e6a7170d1048eee5fd8765f94e423 (patch)
tree71cdf3c69d25493f54b01f57e0ed24212b1211fc /host/lib
parentb913183c4c69678f2e9528179732e696ca713a78 (diff)
downloaduhd-dc2f14d7f95e6a7170d1048eee5fd8765f94e423.tar.gz
uhd-dc2f14d7f95e6a7170d1048eee5fd8765f94e423.tar.bz2
uhd-dc2f14d7f95e6a7170d1048eee5fd8765f94e423.zip
usrp2: cleanup for fifo control wraparound_lt16 routine
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp8
1 files changed, 3 insertions, 5 deletions
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){