USRP Hardware Driver and Device Manual  Version: 4.11.0.0-0-g0d7ed3b1
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 #pragma once
9 
10 #include <uhd/config.hpp>
11 #include <uhd/types/endianness.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>
32 T ntohx(T);
33 
35 template <typename T>
36 T htonx(T);
37 
43 template <typename T>
44 T wtohx(T);
45 
51 template <typename T>
52 T htowx(T);
53 
64 template <endianness_t endianness, typename T>
65 T htolx(T num);
66 
77 template <endianness_t endianness, typename T>
78 T ltohx(T num);
79 
80 } // namespace uhd
81 
82 #include <uhd/utils/byteswap.ipp>
Definition: build_info.hpp:12
T ntohx(T)
network 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:86
T htowx(T)
host to worknet: short, long, or long-long.
Definition: byteswap.ipp:141
T htolx(T num)
Host to link with configurable endianness (16-bit, 32-bit, or 64-bit).
Definition: byteswap.ipp:151
T wtohx(T)
worknet to host: short, long, or long-long.
Definition: byteswap.ipp:131
T ltohx(T num)
Link with configurable endianness to host (16-bit, 32-bit, or 64-bit).
Definition: byteswap.ipp:169
T htonx(T)
host to network: short, long, or long-long
Definition: byteswap.ipp:121