USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-gdca39145
UHD and USRP Manual
byteswap.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011 Ettus Research LLC
3 //
4 // SPDX-License-Identifier: GPL-3.0
5 //
6 
7 #ifndef INCLUDED_UHD_UTILS_BYTESWAP_HPP
8 #define INCLUDED_UHD_UTILS_BYTESWAP_HPP
9 
10 #include <uhd/config.hpp>
11 #include <stdint.h>
12 
18 namespace uhd{
19 
21  uint16_t byteswap(uint16_t);
22 
24  uint32_t byteswap(uint32_t);
25 
27  uint64_t byteswap(uint64_t);
28 
30  template<typename T> T ntohx(T);
31 
33  template<typename T> T htonx(T);
34 
36  //
37  // The argument is assumed to be little-endian (i.e, the inverse
38  // of typical network endianness).
39  template<typename T> T wtohx(T);
40 
42  //
43  // The return value is little-endian (i.e, the inverse
44  // of typical network endianness).
45  template<typename T> T htowx(T);
46 
47 } //namespace uhd
48 
49 #include <uhd/utils/byteswap.ipp>
50 
51 #endif /* INCLUDED_UHD_UTILS_BYTESWAP_HPP */
T htowx(T)
host to worknet: short, long, or long-long
Definition: byteswap.ipp:119
T wtohx(T)
worknet to host: short, long, or long-long
Definition: byteswap.ipp:111
uint16_t byteswap(uint16_t)
perform a byteswap on a 16 bit integer
Definition: byteswap.ipp:74
Definition: build_info.hpp:14
T htonx(T)
host to network: short, long, or long-long
Definition: byteswap.ipp:103
T ntohx(T)
network to host: short, long, or long-long
Definition: byteswap.ipp:95