5#ifndef RUNTIME_PLATFORM_UTILS_MACOS_H_
6#define RUNTIME_PLATFORM_UTILS_MACOS_H_
8#if !defined(RUNTIME_PLATFORM_UTILS_H_)
9#error Do not include utils_macos.h directly; use utils.h instead.
12#include <AvailabilityMacros.h>
13#include <libkern/OSByteOrder.h>
26#define DEFINE_IS_OS_FUNCS(VERSION) \
27 inline bool IsAtLeastOS##VERSION() { \
28 return (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_##VERSION) || \
29 (internal::MacOSXVersion() >= MAC_OS_X_VERSION_##VERSION); \
41inline uint16_t
Utils::HostToBigEndian16(uint16_t value) {
42 return OSSwapHostToBigInt16(
value);
46 return OSSwapHostToBigInt32(value);
50 return OSSwapHostToBigInt64(value);
54 return OSSwapHostToLittleInt16(value);
58 return OSSwapHostToLittleInt32(value);
62 return OSSwapHostToLittleInt64(value);
66 if (strerror_r(err,
buffer, bufsize) != 0) {
67 snprintf(
buffer, bufsize,
"%s",
"strerror_r failed");
static uint64_t HostToBigEndian64(uint64_t host_value)
static uint64_t HostToLittleEndian64(uint64_t host_value)
static uint16_t HostToLittleEndian16(uint16_t host_value)
static char * StrError(int err, char *buffer, size_t bufsize)
static uint32_t HostToLittleEndian32(uint32_t host_value)
static uint32_t HostToBigEndian32(uint32_t host_value)
static const uint8_t buffer[]
char * CheckIsAtLeastMinRequiredMacOSVersion()
#define DEFINE_IS_OS_FUNCS(VERSION)