Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions | Variables
endianness.h File Reference
#include <cstdint>
#include <type_traits>
#include "flutter/fml/build_config.h"

Go to the source code of this file.

Classes

struct  fml::IsByteSwappable< T >
 

Namespaces

namespace  fml
 

Macros

#define FML_BYTESWAP_16(n)   __builtin_bswap16(n)
 
#define FML_BYTESWAP_32(n)   __builtin_bswap32(n)
 
#define FML_BYTESWAP_64(n)   __builtin_bswap64(n)
 

Functions

template<typename T , class = std::enable_if_t<kIsByteSwappableV<T>>>
constexpr T fml::ByteSwap (T n)
 Flips the endianness of the given value. The given value must be an integral type of size 1, 2, 4, or 8.
 
template<typename T , class = std::enable_if_t<kIsByteSwappableV<T>>>
constexpr T fml::BigEndianToArch (T n)
 Convert a known big endian value to match the endianness of the current architecture. This is effectively a cross platform ntohl/ntohs (as network byte order is always Big Endian). The given value must be an integral type of size 1, 2, 4, or 8.
 
template<typename T , class = std::enable_if_t<kIsByteSwappableV<T>>>
constexpr T fml::LittleEndianToArch (T n)
 Convert a known little endian value to match the endianness of the current architecture. The given value must be an integral type of size 1, 2, 4, or 8.
 

Variables

template<typename T >
constexpr bool fml::kIsByteSwappableV = IsByteSwappable<T>::value
 

Macro Definition Documentation

◆ FML_BYTESWAP_16

#define FML_BYTESWAP_16 (   n)    __builtin_bswap16(n)

Definition at line 22 of file endianness.h.

◆ FML_BYTESWAP_32

#define FML_BYTESWAP_32 (   n)    __builtin_bswap32(n)

Definition at line 23 of file endianness.h.

◆ FML_BYTESWAP_64

#define FML_BYTESWAP_64 (   n)    __builtin_bswap64(n)

Definition at line 24 of file endianness.h.