14#ifndef WPIUTIL_WPI_SWAPBYTEORDER_H
15#define WPIUTIL_WPI_SWAPBYTEORDER_H
18#include "wpi/util/bit.hpp"
27 wpi::util::endianness::native == wpi::util::endianness::big;
31inline unsigned char getSwappedBytes(
unsigned char C) {
return wpi::util::byteswap(C); }
32inline signed char getSwappedBytes(
signed char C) {
return wpi::util::byteswap(C); }
35inline unsigned short getSwappedBytes(
unsigned short C) {
return wpi::util::byteswap(C); }
36inline signed short getSwappedBytes(
signed short C) {
return wpi::util::byteswap(C); }
38inline unsigned int getSwappedBytes(
unsigned int C) {
return wpi::util::byteswap(C); }
39inline signed int getSwappedBytes(
signed int C) {
return wpi::util::byteswap(C); }
41inline unsigned long getSwappedBytes(
unsigned long C) {
return wpi::util::byteswap(C); }
42inline signed long getSwappedBytes(
signed long C) {
return wpi::util::byteswap(C); }
44inline unsigned long long getSwappedBytes(
unsigned long long C) {
return wpi::util::byteswap(C); }
45inline signed long long getSwappedBytes(
signed long long C) {
return wpi::util::byteswap(C); }
48 return wpi::util::bit_cast<float>(wpi::util::byteswap(wpi::util::bit_cast<uint32_t>(C)));
52 return wpi::util::bit_cast<double>(wpi::util::byteswap(wpi::util::bit_cast<uint64_t>(C)));
This file contains library features backported from future STL versions.
void swapByteOrder(T &Value)
Definition SwapByteOrder.hpp:61
static const bool IsLittleEndianHost
Definition SwapByteOrder.hpp:29
unsigned char getSwappedBytes(unsigned char C)
Definition SwapByteOrder.hpp:31
constexpr bool IsBigEndianHost
Definition SwapByteOrder.hpp:26
Definition raw_os_ostream.hpp:19
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
Definition STLForwardCompat.hpp:66