diff options
author | Ashish Chaudhari <ashish@ettus.com> | 2015-08-05 23:14:54 -0500 |
---|---|---|
committer | Ashish Chaudhari <ashish@ettus.com> | 2015-08-05 23:14:54 -0500 |
commit | c7f24e49db47aec2008b072bb6fb9b6dddc36797 (patch) | |
tree | 82a1265ddbf10cc2e554457c5e3ddab801a56ae6 /host/include | |
parent | 55a280a09905567b61e4cf7c7aecfa971947131c (diff) | |
download | uhd-c7f24e49db47aec2008b072bb6fb9b6dddc36797.tar.gz uhd-c7f24e49db47aec2008b072bb6fb9b6dddc36797.tar.bz2 uhd-c7f24e49db47aec2008b072bb6fb9b6dddc36797.zip |
uhd: Removed dependency on boost/lockfree
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/utils/soft_register.hpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/host/include/uhd/utils/soft_register.hpp b/host/include/uhd/utils/soft_register.hpp index f28b2aa2a..9c407cd74 100644 --- a/host/include/uhd/utils/soft_register.hpp +++ b/host/include/uhd/utils/soft_register.hpp @@ -28,7 +28,6 @@ #include <boost/tokenizer.hpp> #include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> -#include <boost/lockfree/detail/branch_hints.hpp> //================================================================== // Soft Register Definition @@ -39,6 +38,28 @@ namespace uhd { +//TODO: These hints were added to boost 1.53. + +/** \brief hint for the branch prediction */ +inline bool likely(bool expr) +{ +#ifdef __GNUC__ + return __builtin_expect(expr, true); +#else + return expr; +#endif + } + +/** \brief hint for the branch prediction */ +inline bool unlikely(bool expr) +{ +#ifdef __GNUC__ + return __builtin_expect(expr, false); +#else + return expr; +#endif +} + /* A register field is defined as a tuple of the mask and the shift. * It can be used to make read-modify-write operations more convenient * For efficiency reasons, it is recommended to always use a constant @@ -62,7 +83,7 @@ namespace soft_reg_field { //Behavior for the left shit operation is undefined in C++ //if the shift amount is >= bitwidth of the datatype //So we treat that as a special case with a branch predicition hint - if (boost::lockfree::detail::likely((sizeof(data_t)*8) != width(field))) + if (likely((sizeof(data_t)*8) != width(field))) return ((ONE<<width(field))-ONE)<<shift(field); else return (0-ONE)<<shift(field); |