USRP Hardware Driver and USRP Manual  Version: 3.15.0.0-4+b1satnogs1
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 <uhd/types/endianness.hpp>
13 #include <stdint.h>
14 
20 namespace uhd {
21 
23 uint16_t byteswap(uint16_t);
24 
26 uint32_t byteswap(uint32_t);
27 
29 uint64_t byteswap(uint64_t);
30 
32 template <typename T>
33 T ntohx(T);
34 
36 template <typename T>
37 T htonx(T);
38 
40 //
41 // The argument is assumed to be little-endian (i.e, the inverse
42 // of typical network endianness).
43 template <typename T>
44 T wtohx(T);
45 
47 //
48 // The return value is little-endian (i.e, the inverse
49 // of typical network endianness).
50 template <typename T>
51 T htowx(T);
52 
53 } // namespace uhd
54 
55 #include <uhd/utils/byteswap.ipp>
56 
57 #endif /* INCLUDED_UHD_UTILS_BYTESWAP_HPP */
Definition: build_info.hpp:13
T ntohx(T)
network 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:88
T htowx(T)
host to worknet: short, long, or long-long
Definition: byteswap.ipp:139
T wtohx(T)
worknet to host: short, long, or long-long
Definition: byteswap.ipp:130
T htonx(T)
host to network: short, long, or long-long
Definition: byteswap.ipp:121