HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
platform.h File Reference

Platform-related macros. More...

#include <utility>
#include <cstdint>
#include <OpenImageIO/oiioversion.h>
+ Include dependency graph for platform.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __STDC_LIMIT_MACROS   /* needed for some defs in stdint.h */
 
#define OIIO_CONSTEXPR   constexpr
 
#define OIIO_CONSTEXPR_OR_CONST   constexpr
 
#define OIIO_NOEXCEPT   noexcept
 
#define __has_cpp_attribute(x)   0
 
#define __has_attribute(x)   0
 
#define __has_include(x)   0
 
#define OIIO_GNUC_VERSION   0
 
#define OIIO_CLANG_VERSION   0
 
#define OIIO_APPLE_CLANG_VERSION   0
 
#define OIIO_MSVS_AT_LEAST_2013   0
 
#define OIIO_MSVS_BEFORE_2013   0
 
#define OIIO_MSVS_AT_LEAST_2015   0
 
#define OIIO_MSVS_BEFORE_2015   0
 
#define OIIO_MSVS_AT_LEAST_2017   0
 
#define OIIO_MSVS_BEFORE_2017   0
 
#define OIIO_ALLOCA(type, size)   ((size) != 0 ? ((type*)alloca((size) * sizeof (type))) : nullptr)
 allocates memory, equivalent of C99 type var_name[size] More...
 
#define ALLOCA(type, size)   ((size) != 0 ? ((type*)alloca((size) * sizeof (type))) : nullptr)
 Deprecated (for namespace pollution reasons) More...
 
#define OIIO_CACHE_LINE_SIZE   64
 
#define OIIO_CACHE_ALIGN   OIIO_ALIGN(OIIO_CACHE_LINE_SIZE)
 
#define OIIO_LIKELY(x)   (x)
 
#define OIIO_UNLIKELY(x)   (x)
 
#define OIIO_FORCEINLINE   inline
 
#define OIIO_PURE_FUNC
 
#define OIIO_CONST_FUNC
 
#define OIIO_MAYBE_UNUSED
 
#define OIIO_UNUSED_OK   OIIO_MAYBE_UNUSED
 
#define OIIO_RESTRICT
 
#define OIIO_DEPRECATED(msg)
 
#define OIIO_FALLTHROUGH
 
#define OIIO_NODISCARD
 
#define OIIO_NO_SANITIZE_ADDRESS
 
#define OIIO_HOSTDEVICE
 

Enumerations

enum  endian { endian::little = __ORDER_LITTLE_ENDIAN__, endian::big = __ORDER_BIG_ENDIAN__, endian::native = __BYTE_ORDER__ }
 

Functions

OIIO_FORCEINLINE constexpr bool littleendian (void)
 Return true if the architecture we are running on is little endian. More...
 
OIIO_FORCEINLINE constexpr bool bigendian (void)
 Return true if the architecture we are running on is big endian. More...
 
void cpuid (int info[4], int infoType, int extra)
 Retrieve cpuid flags into 'info'. More...
 
bool cpu_has_sse2 ()
 
bool cpu_has_sse3 ()
 
bool cpu_has_ssse3 ()
 
bool cpu_has_fma ()
 
bool cpu_has_sse41 ()
 
bool cpu_has_sse42 ()
 
bool cpu_has_popcnt ()
 
bool cpu_has_avx ()
 
bool cpu_has_f16c ()
 
bool cpu_has_rdrand ()
 
bool cpu_has_avx2 ()
 
bool cpu_has_avx512f ()
 
bool cpu_has_avx512dq ()
 
bool cpu_has_avx512ifma ()
 
bool cpu_has_avx512pf ()
 
bool cpu_has_avx512er ()
 
bool cpu_has_avx512cd ()
 
bool cpu_has_avx512bw ()
 
bool cpu_has_avx512vl ()
 
voidaligned_malloc (std::size_t size, std::size_t align)
 
void aligned_free (void *ptr)
 
template<typename T , class... Args>
T * aligned_new (Args &&...args)
 
template<typename T >
void aligned_delete (T *t)
 

Detailed Description

Platform-related macros.

Definition in file platform.h.

Macro Definition Documentation

#define __has_attribute (   x)    0

Definition at line 130 of file platform.h.

#define __has_cpp_attribute (   x)    0

Definition at line 125 of file platform.h.

#define __has_include (   x)    0

Definition at line 136 of file platform.h.

#define __STDC_LIMIT_MACROS   /* needed for some defs in stdint.h */

Definition at line 46 of file platform.h.

#define ALLOCA (   type,
  size 
)    ((size) != 0 ? ((type*)alloca((size) * sizeof (type))) : nullptr)

Deprecated (for namespace pollution reasons)

Definition at line 194 of file platform.h.

#define OIIO_ALLOCA (   type,
  size 
)    ((size) != 0 ? ((type*)alloca((size) * sizeof (type))) : nullptr)

allocates memory, equivalent of C99 type var_name[size]

Definition at line 191 of file platform.h.

#define OIIO_APPLE_CLANG_VERSION   0

Definition at line 166 of file platform.h.

#define OIIO_CACHE_ALIGN   OIIO_ALIGN(OIIO_CACHE_LINE_SIZE)

Definition at line 215 of file platform.h.

#define OIIO_CACHE_LINE_SIZE   64

Definition at line 212 of file platform.h.

#define OIIO_CLANG_VERSION   0

Definition at line 158 of file platform.h.

#define OIIO_CONST_FUNC

Definition at line 277 of file platform.h.

#define OIIO_CONSTEXPR   constexpr

Definition at line 115 of file platform.h.

#define OIIO_CONSTEXPR_OR_CONST   constexpr

Definition at line 116 of file platform.h.

#define OIIO_DEPRECATED (   msg)

Definition at line 310 of file platform.h.

#define OIIO_FALLTHROUGH

Definition at line 318 of file platform.h.

#define OIIO_FORCEINLINE   inline

Definition at line 249 of file platform.h.

#define OIIO_GNUC_VERSION   0

Definition at line 148 of file platform.h.

#define OIIO_HOSTDEVICE

Definition at line 348 of file platform.h.

#define OIIO_LIKELY (   x)    (x)

Definition at line 233 of file platform.h.

#define OIIO_MAYBE_UNUSED

Definition at line 287 of file platform.h.

#define OIIO_MSVS_AT_LEAST_2013   0

Definition at line 181 of file platform.h.

#define OIIO_MSVS_AT_LEAST_2015   0

Definition at line 183 of file platform.h.

#define OIIO_MSVS_AT_LEAST_2017   0

Definition at line 185 of file platform.h.

#define OIIO_MSVS_BEFORE_2013   0

Definition at line 182 of file platform.h.

#define OIIO_MSVS_BEFORE_2015   0

Definition at line 184 of file platform.h.

#define OIIO_MSVS_BEFORE_2017   0

Definition at line 186 of file platform.h.

#define OIIO_NO_SANITIZE_ADDRESS

Definition at line 339 of file platform.h.

#define OIIO_NODISCARD

Definition at line 327 of file platform.h.

#define OIIO_NOEXCEPT   noexcept

Definition at line 119 of file platform.h.

#define OIIO_PURE_FUNC

Definition at line 263 of file platform.h.

#define OIIO_RESTRICT

Definition at line 299 of file platform.h.

#define OIIO_UNLIKELY (   x)    (x)

Definition at line 234 of file platform.h.

#define OIIO_UNUSED_OK   OIIO_MAYBE_UNUSED

Definition at line 291 of file platform.h.

Enumeration Type Documentation

enum endian
strong

Class for describing endianness. Test for endianness as if (endian::native == endian::little) or if (endian::native == endian::big). This uses the same semantics as C++20's std::endian.

Enumerator
little 
big 
native 

Definition at line 358 of file platform.h.

Function Documentation

template<typename T >
void aligned_delete ( T *  t)
inline

Definition at line 448 of file platform.h.

void aligned_free ( void ptr)
void* aligned_malloc ( std::size_t  size,
std::size_t  align 
)
template<typename T , class... Args>
T* aligned_new ( Args &&...  args)
inline

Definition at line 441 of file platform.h.

OIIO_FORCEINLINE constexpr bool bigendian ( void  )

Return true if the architecture we are running on is big endian.

Definition at line 381 of file platform.h.

bool cpu_has_avx ( )
inline

Definition at line 422 of file platform.h.

bool cpu_has_avx2 ( )
inline

Definition at line 425 of file platform.h.

bool cpu_has_avx512bw ( )
inline

Definition at line 432 of file platform.h.

bool cpu_has_avx512cd ( )
inline

Definition at line 431 of file platform.h.

bool cpu_has_avx512dq ( )
inline

Definition at line 427 of file platform.h.

bool cpu_has_avx512er ( )
inline

Definition at line 430 of file platform.h.

bool cpu_has_avx512f ( )
inline

Definition at line 426 of file platform.h.

bool cpu_has_avx512ifma ( )
inline

Definition at line 428 of file platform.h.

bool cpu_has_avx512pf ( )
inline

Definition at line 429 of file platform.h.

bool cpu_has_avx512vl ( )
inline

Definition at line 433 of file platform.h.

bool cpu_has_f16c ( )
inline

Definition at line 423 of file platform.h.

bool cpu_has_fma ( )
inline

Definition at line 418 of file platform.h.

bool cpu_has_popcnt ( )
inline

Definition at line 421 of file platform.h.

bool cpu_has_rdrand ( )
inline

Definition at line 424 of file platform.h.

bool cpu_has_sse2 ( )
inline

Definition at line 415 of file platform.h.

bool cpu_has_sse3 ( )
inline

Definition at line 416 of file platform.h.

bool cpu_has_sse41 ( )
inline

Definition at line 419 of file platform.h.

bool cpu_has_sse42 ( )
inline

Definition at line 420 of file platform.h.

bool cpu_has_ssse3 ( )
inline

Definition at line 417 of file platform.h.

void cpuid ( int  info[4],
int  infoType,
int  extra 
)
inline

Retrieve cpuid flags into 'info'.

Definition at line 389 of file platform.h.

OIIO_FORCEINLINE constexpr bool littleendian ( void  )

Return true if the architecture we are running on is little endian.

Definition at line 373 of file platform.h.