USRP Hardware Driver and USRP Manual Version: 4.2.0.0
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>
12#include <stdint.h>
13
19namespace uhd {
20
22uint16_t byteswap(uint16_t);
23
25uint32_t byteswap(uint32_t);
26
28uint64_t byteswap(uint64_t);
29
31template <typename T>
32T ntohx(T);
33
35template <typename T>
36T htonx(T);
37
39//
40// The argument is assumed to be little-endian (i.e, the inverse
41// of typical network endianness).
42template <typename T>
43T wtohx(T);
44
46//
47// The return value is little-endian (i.e, the inverse
48// of typical network endianness).
49template <typename T>
50T htowx(T);
51
52} // namespace uhd
53
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:87
T htowx(T)
host to worknet: short, long, or long-long
Definition: byteswap.ipp:138
T wtohx(T)
worknet to host: short, long, or long-long
Definition: byteswap.ipp:129
T htonx(T)
host to network: short, long, or long-long
Definition: byteswap.ipp:120