USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-ga1b5c4ae
UHD and USRP Manual
byteswap.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #ifndef INCLUDED_UHD_UTILS_BYTESWAP_HPP
9 #define INCLUDED_UHD_UTILS_BYTESWAP_HPP
10 
11 #include <uhd/config.hpp>
12 #include <stdint.h>
13 
19 namespace uhd{
20 
22  uint16_t byteswap(uint16_t);
23 
25  uint32_t byteswap(uint32_t);
26 
28  uint64_t byteswap(uint64_t);
29 
31  template<typename T> T ntohx(T);
32 
34  template<typename T> T htonx(T);
35 
37  //
38  // The argument is assumed to be little-endian (i.e, the inverse
39  // of typical network endianness).
40  template<typename T> T wtohx(T);
41 
43  //
44  // The return value is little-endian (i.e, the inverse
45  // of typical network endianness).
46  template<typename T> T htowx(T);
47 
48 } //namespace uhd
49 
50 #include <uhd/utils/byteswap.ipp>
51 
52 #endif /* INCLUDED_UHD_UTILS_BYTESWAP_HPP */
T htowx(T)
host to worknet: short, long, or long-long
Definition: byteswap.ipp:120
T wtohx(T)
worknet to host: short, long, or long-long
Definition: byteswap.ipp:112
uint16_t byteswap(uint16_t)
perform a byteswap on a 16 bit integer
Definition: byteswap.ipp:75
Definition: build_info.hpp:14
T htonx(T)
host to network: short, long, or long-long
Definition: byteswap.ipp:104
T ntohx(T)
network to host: short, long, or long-long
Definition: byteswap.ipp:96