Sese Framework
x.y.z
A cross-platform framework
|
字节序转换 更多...
#include <type_traits>
#include <cstring>
#include <cstdint>
宏定义 | |
#define | ByteSwap16(i16) ((i16 & 0x00FF) << 8 | (i16 & 0xFF00) >> 8) |
#define | ByteSwap32(i32) ((i32 & 0x000000FF) << 24 | (i32 & 0x0000FF00) << 8 | (i32 & 0x00FF0000) >> 8 | (i32 & 0xFF000000) >> 24) |
#define | ByteSwap64(i64) |
#define | SESE_LITTLE_ENDIAN |
#define | ASSERT_FLOAT_SIZE static_assert(sizeof(float) == 4, "Float size is not 4 bytes") |
#define | ASSERT_DOUBLE_SIZE static_assert(sizeof(double) == 8, "Double size is not 8 bytes") |
枚举 | |
enum class | EndianType { LITTLE , BIG } |
函数 | |
template<typename T > | |
T | ToBigEndian16 (T t) |
template<typename T > | |
T | ToBigEndian32 (T t) |
template<typename T > | |
T | ToBigEndian64 (T t) |
template<typename T > | |
T | ToLittleEndian16 (T t) |
template<typename T > | |
T | ToLittleEndian32 (T t) |
template<typename T > | |
T | ToLittleEndian64 (T t) |
template<typename T > | |
T | FromBigEndian16 (T t) |
template<typename T > | |
T | FromBigEndian32 (T t) |
template<typename T > | |
T | FromBigEndian64 (T t) |
template<typename T > | |
T | FromLittleEndian16 (T t) |
template<typename T > | |
T | FromLittleEndian32 (T t) |
template<typename T > | |
T | FromLittleEndian64 (T t) |
template<typename T > | |
std::enable_if< sizeof(T)==2, T >::t | ToBigEndian (T t) |
template<typename T > | |
std::enable_if< sizeof(T)==4, T >::t | ToBigEndian (T t) |
template<typename T > | |
std::enable_if< sizeof(T)==8, T >::t | ToBigEndian (T t) |
template<typename T > | |
T | ToLittleEndian (T t) |
template<typename T > | |
std::enable_if< sizeof(T)==2, T >::t | FromBigEndian (T t) |
template<typename T > | |
std::enable_if< sizeof(T)==4, T >::t | FromBigEndian (T t) |
template<typename T > | |
std::enable_if< sizeof(T)==8, T >::t | FromBigEndian (T t) |
template<typename T > | |
T | FromLittleEndian (T t) |
template<> | |
float | ToBigEndian32 (float t) |
template<> | |
double | ToBigEndian64 (double t) |
template<> | |
float | ToLittleEndian32 (float t) |
template<> | |
double | ToLittleEndian64 (double t) |
template<> | |
float | FromBigEndian32 (float t) |
template<> | |
double | FromBigEndian64 (double t) |
template<> | |
float | FromLittleEndian32 (float t) |
template<> | |
double | FromLittleEndian64 (double t) |
字节序转换
#define ASSERT_DOUBLE_SIZE static_assert(sizeof(double) == 8, "Double size is not 8 bytes") |
被这些函数引用 FromBigEndian64(), FromLittleEndian64(), ToBigEndian64() , 以及 ToLittleEndian64().
#define ASSERT_FLOAT_SIZE static_assert(sizeof(float) == 4, "Float size is not 4 bytes") |
被这些函数引用 FromBigEndian32(), FromLittleEndian32(), ToBigEndian32() , 以及 ToLittleEndian32().
#define ByteSwap16 | ( | i16 | ) | ((i16 & 0x00FF) << 8 | (i16 & 0xFF00) >> 8) |
被这些函数引用 FromBigEndian(), FromBigEndian16(), ToBigEndian() , 以及 ToBigEndian16().
#define ByteSwap32 | ( | i32 | ) | ((i32 & 0x000000FF) << 24 | (i32 & 0x0000FF00) << 8 | (i32 & 0x00FF0000) >> 8 | (i32 & 0xFF000000) >> 24) |
被这些函数引用 FromBigEndian(), FromBigEndian32(), ToBigEndian() , 以及 ToBigEndian32().
#define ByteSwap64 | ( | i64 | ) |
被这些函数引用 FromBigEndian(), FromBigEndian64(), ToBigEndian() , 以及 ToBigEndian64().
#define SESE_LITTLE_ENDIAN |
|
strong |
|
inline |
引用了 ByteSwap16.
|
inline |
引用了 ByteSwap32.
|
inline |
引用了 ByteSwap64.
|
inline |
引用了 ByteSwap16.
被这些函数引用 sese::net::dns::DnsPackage::decode(), sese::net::dns::DnsPackage::decodeAnswers(), sese::net::dns::DnsPackage::decodeWords(), sese::net::IPv4Address::getPort(), sese::net::IPv6Address::getPort(), sese::internal::service::http::HttpConnectionEx::handleSettingsFrame() , 以及 sese::net::Socket::readInt16().
|
inline |
引用了 ASSERT_FLOAT_SIZE , 以及 FromBigEndian32().
|
inline |
引用了 ByteSwap32.
被这些函数引用 sese::Bitset32::Bitset32(), sese::net::dns::DnsPackage::decodeAnswers(), sese::SHA1Util::encode(), sese::Base64Converter::encodeBase62(), FromBigEndian32(), FromLittleEndian32(), sese::Bitset32::get(), sese::internal::service::http::HttpConnectionEx::handleGoawayFrame(), sese::internal::service::http::HttpConnectionEx::handleHeadersFrame(), sese::internal::service::http::HttpConnectionEx::handlePriorityFrame(), sese::internal::service::http::HttpConnectionEx::handleRstStreamFrame(), sese::internal::service::http::HttpConnectionEx::handleSettingsFrame(), sese::internal::service::http::HttpConnectionEx::handleWindowUpdate(), sese::Bitset32::operator+() , 以及 sese::internal::service::http::HttpConnectionEx::readFrameHeader().
|
inline |
引用了 ASSERT_DOUBLE_SIZE , 以及 FromBigEndian64().
|
inline |
引用了 ByteSwap64.
被这些函数引用 FromBigEndian64() , 以及 FromLittleEndian64().
|
inline |
|
inline |
|
inline |
引用了 ASSERT_FLOAT_SIZE , 以及 FromBigEndian32().
|
inline |
|
inline |
引用了 ASSERT_DOUBLE_SIZE , 以及 FromBigEndian64().
|
inline |
|
inline |
引用了 ByteSwap16.
|
inline |
引用了 ByteSwap32.
|
inline |
引用了 ByteSwap64.
|
inline |
引用了 ByteSwap16.
被这些函数引用 sese::net::IPv4Address::create(), sese::net::IPv6Address::create(), sese::net::dns::DnsPackage::encode(), sese::net::dns::DnsPackage::encodeAnswers(), sese::net::dns::DnsPackage::encodeQuestions(), sese::net::dns::DnsPackage::Index::encodeWords(), sese::net::IPv6Address::getAddress(), sese::net::IPv4Address::IPv4Address(), sese::net::IPv6Address::IPv6Address(), sese::MemoryViewer::peer16(), sese::net::IPv4Address::setPort(), sese::net::IPv6Address::setPort(), sese::net::Socket::writeInt16() , 以及 sese::internal::service::http::HttpConnectionEx::writeSettingsFrame().
|
inline |
引用了 ASSERT_FLOAT_SIZE , 以及 ToBigEndian32().
|
inline |
引用了 ByteSwap32.
被这些函数引用 sese::net::http::Http2Frame::buildFrameHeader(), sese::Base64Converter::decodeBase62(), sese::net::dns::DnsPackage::encodeAnswers(), sese::net::IPv4Address::getBroadcastAddress(), sese::net::IPv4Address::getNetworkAddress(), sese::net::IPv4Address::getSubnetMask(), sese::net::IPv4Address::IPv4Address(), sese::Bitset32::operator+(), sese::MemoryViewer::peer32(), sese::Bitset32::set(), ToBigEndian32(), ToLittleEndian32(), sese::internal::service::http::HttpConnectionEx::writeGoawayFrame(), sese::internal::service::http::HttpConnectionEx::writeRstStreamFrame(), sese::internal::service::http::HttpConnectionEx::writeSettingsFrame() , 以及 sese::internal::service::http::HttpConnectionEx::writeWindowUpdateFrame().
|
inline |
引用了 ASSERT_DOUBLE_SIZE , 以及 ToBigEndian64().
|
inline |
|
inline |
被这些函数引用 sese::SHA256Util::encode().
|
inline |
被这些函数引用 sese::MemoryViewer::peer16().
|
inline |
引用了 ASSERT_FLOAT_SIZE , 以及 ToBigEndian32().
|
inline |
|
inline |
引用了 ASSERT_DOUBLE_SIZE , 以及 ToBigEndian64().
|
inline |
被这些函数引用 sese::MD5Util::encode() , 以及 sese::MemoryViewer::peer64().