diff options
| -rw-r--r-- | host/include/uhd/utils/byteswap.hpp | 8 | ||||
| -rw-r--r-- | host/include/uhd/utils/byteswap.ipp | 16 | 
2 files changed, 23 insertions, 1 deletions
| diff --git a/host/include/uhd/utils/byteswap.hpp b/host/include/uhd/utils/byteswap.hpp index 9a1871210..2b5a46c66 100644 --- a/host/include/uhd/utils/byteswap.hpp +++ b/host/include/uhd/utils/byteswap.hpp @@ -1,5 +1,5 @@  // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 Ettus Research LLC  //  // This program is free software: you can redistribute it and/or modify  // it under the terms of the GNU General Public License as published by @@ -43,6 +43,12 @@ namespace uhd{      //! host to network: short, long, or long-long      template<typename T> T htonx(T); +    //! worknet to host: short, long, or long-long +    template<typename T> T wtohx(T); + +    //! host to worknet: short, long, or long-long +    template<typename T> T htowx(T); +  } //namespace uhd  #include <uhd/utils/byteswap.ipp> diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp index c090dee55..51e9c28a0 100644 --- a/host/include/uhd/utils/byteswap.ipp +++ b/host/include/uhd/utils/byteswap.ipp @@ -117,4 +117,20 @@ template<typename T> UHD_INLINE T uhd::htonx(T num){      #endif  } +template<typename T> UHD_INLINE T uhd::wtohx(T num){ +    #ifdef BOOST_BIG_ENDIAN +        return uhd::byteswap(num); +    #else +        return num; +    #endif +} + +template<typename T> UHD_INLINE T uhd::htowx(T num){ +    #ifdef BOOST_BIG_ENDIAN +        return uhd::byteswap(num); +    #else +        return num; +    #endif +} +  #endif /* INCLUDED_UHD_UTILS_BYTESWAP_IPP */ | 
