Files
bx/include/bx/endian.h
luzpaz ad018d47c6 Fix various typos (#272)
* Fix various typos

Found via `codespell -q 3 -S ./3rdparty -L ba,nin,numer,ro`

* Fix source typo in tests/crt_test.cpp
2022-02-05 19:08:43 -08:00

51 lines
1.1 KiB
C++

/*
* Copyright 2010-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx/blob/master/LICENSE
*/
#ifndef BX_ENDIAN_H_HEADER_GUARD
#define BX_ENDIAN_H_HEADER_GUARD
#include "bx.h"
namespace bx
{
///
int16_t endianSwap(int16_t _in);
///
uint16_t endianSwap(uint16_t _in);
///
int32_t endianSwap(int32_t _in);
///
uint32_t endianSwap(uint32_t _in);
///
int64_t endianSwap(int64_t _in);
///
uint64_t endianSwap(uint64_t _in);
/// Input argument is encoded as little endian, convert it if necessary
/// depending on host CPU endianness.
template <typename Ty>
Ty toLittleEndian(const Ty _in);
/// Input argument is encoded as big endian, convert it if necessary
/// depending on host CPU endianness.
template <typename Ty>
Ty toBigEndian(const Ty _in);
/// If _littleEndian is true, converts input argument to from little endian
/// to host CPU endiness.
template <typename Ty>
Ty toHostEndian(const Ty _in, bool _fromLittleEndian);
} // namespace bx
#include "inline/endian.inl"
#endif // BX_ENDIAN_H_HEADER_GUARD