HDK
|
#include <cassert>
#include <cstdlib>
#include <type_traits>
#include <utility>
#include <cstdint>
#include <OpenImageIO/oiioversion.h>
#include <OpenImageIO/export.h>
Go to the source code of this file.
Typedefs | |
template<bool B, class T = void> | |
using | enable_if_t = typename std::enable_if< B, T >::type |
Enumerations | |
enum | endian { endian::little = __ORDER_LITTLE_ENDIAN__, endian::big = __ORDER_BIG_ENDIAN__, endian::native = __BYTE_ORDER__ } |
Functions | |
OIIO_FORCEINLINE constexpr bool | littleendian (void) noexcept |
Return true if the architecture we are running on is little endian. More... | |
OIIO_FORCEINLINE constexpr bool | bigendian (void) noexcept |
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 () |
OIIO_API void * | aligned_malloc (std::size_t size, std::size_t align) |
OIIO_API void | aligned_free (void *ptr) |
template<typename T , class... Args> | |
T * | aligned_new (Args &&...args) |
template<typename T > | |
void | aligned_delete (T *t) |
#define __has_attribute | ( | x | ) | 0 |
Definition at line 126 of file platform.h.
#define __has_cpp_attribute | ( | x | ) | 0 |
Definition at line 121 of file platform.h.
#define __has_include | ( | x | ) | 0 |
Definition at line 132 of file platform.h.
Definition at line 29 of file platform.h.
#define ALLOCA | ( | type, | |
size | |||
) | OIIO_ALLOCA(type, size) |
Deprecated (for namespace pollution reasons)
Definition at line 285 of file platform.h.
Definition at line 316 of file platform.h.
#define OIIO_ALLOCA | ( | type, | |
size | |||
) | (assert(size < (1<<20)), (size) != 0 ? ((type*)alloca((size) * sizeof(type))) : nullptr) |
OIIO_ALLOCA is used to allocate smallish amount of memory on the stack, equivalent of C99 type var_name[size].
NOTE: in a debug build, this will assert for allocations >= 1MB, which is much too big. Hopefully this will keep us from abusing alloca and having stack overflows. The rule of thumb is that it's ok to use alloca for small things of bounded size (like, one float per channel), but not for anything that could be arbitrarily big (like a full scanline or image, because sooner or later somebody will give you an image big enough to cause trouble). Consider using the OIIO_ALLOCATE_STACK_OR_HEAP idiom rather than a direct OIIO_ALLOCA if you aren't sure the item will be small.
Definition at line 281 of file platform.h.
#define OIIO_ALLOCATE_STACK_OR_HEAP | ( | var, | |
T, | |||
size | |||
) |
Try to allocate T* var to point to T[size] elements of temporary storage that will automatically free when the local scope is exited. Allocate the space on the stack with alloca if it's small, but if it's big (> 64 KB), allocate on the heap with a new[], stored as a std::unique_ptr. In both cases, the memory will be freed automatically upon exit of scope. That threshold is big enough for one scanline of a 4096 x 4 channel x float image, or one 64x64 tile of a 4xfloat image.
Definition at line 295 of file platform.h.
#define OIIO_APPLE_CLANG_VERSION 0 |
Definition at line 172 of file platform.h.
#define OIIO_CACHE_ALIGN OIIO_ALIGN(OIIO_CACHE_LINE_SIZE) |
Definition at line 324 of file platform.h.
#define OIIO_CACHE_LINE_SIZE 64 |
Definition at line 321 of file platform.h.
#define OIIO_CLANG_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 260 of file platform.h.
#define OIIO_CLANG_VERSION 0 |
Definition at line 164 of file platform.h.
#define OIIO_CONST_FUNC |
Definition at line 386 of file platform.h.
#define OIIO_CONSTEXPR constexpr |
Definition at line 111 of file platform.h.
#define OIIO_CONSTEXPR_OR_CONST constexpr |
Definition at line 112 of file platform.h.
#define OIIO_DEPRECATED | ( | msg | ) |
Definition at line 421 of file platform.h.
#define OIIO_ENABLE_IF | ( | ... | ) | OIIO::enable_if_t<(__VA_ARGS__), int> = 0 |
Definition at line 604 of file platform.h.
#define OIIO_FALLTHROUGH |
Definition at line 431 of file platform.h.
#define OIIO_FORCEINLINE inline |
Definition at line 358 of file platform.h.
#define OIIO_GCC_ONLY_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 259 of file platform.h.
#define OIIO_GCC_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 258 of file platform.h.
#define OIIO_GNUC_VERSION 0 |
Definition at line 154 of file platform.h.
#define OIIO_HOSTDEVICE |
Definition at line 471 of file platform.h.
#define OIIO_INTEL_COMPILER_VERSION 0 |
Definition at line 180 of file platform.h.
Definition at line 342 of file platform.h.
#define OIIO_MAYBE_UNUSED |
Definition at line 396 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2013 0 |
Definition at line 203 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2015 0 |
Definition at line 205 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2017 0 |
Definition at line 207 of file platform.h.
#define OIIO_MSVS_BEFORE_2013 0 |
Definition at line 204 of file platform.h.
#define OIIO_MSVS_BEFORE_2015 0 |
Definition at line 206 of file platform.h.
#define OIIO_MSVS_BEFORE_2017 0 |
Definition at line 208 of file platform.h.
#define OIIO_MSVS_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 261 of file platform.h.
#define OIIO_NO_SANITIZE_ADDRESS |
Definition at line 452 of file platform.h.
#define OIIO_NODISCARD |
Definition at line 440 of file platform.h.
#define OIIO_NOEXCEPT noexcept |
Definition at line 115 of file platform.h.
#define OIIO_NON_INTEL_CLANG 0 |
Definition at line 188 of file platform.h.
#define OIIO_PRAGMA | ( | UnQuotedPragma | ) | _Pragma(#UnQuotedPragma) |
Definition at line 227 of file platform.h.
#define OIIO_PRAGMA_VISIBILITY_POP |
Definition at line 257 of file platform.h.
#define OIIO_PRAGMA_VISIBILITY_PUSH |
Definition at line 256 of file platform.h.
#define OIIO_PRAGMA_WARNING_POP |
Definition at line 255 of file platform.h.
#define OIIO_PRAGMA_WARNING_PUSH |
Definition at line 254 of file platform.h.
#define OIIO_PRETTY_FUNCTION __FUNCTION__ |
Definition at line 483 of file platform.h.
#define OIIO_PURE_FUNC |
Definition at line 372 of file platform.h.
#define OIIO_RESTRICT |
Definition at line 408 of file platform.h.
#define OIIO_RETURNS_NONNULL |
Definition at line 462 of file platform.h.
Definition at line 343 of file platform.h.
#define OIIO_UNUSED_OK OIIO_MAYBE_UNUSED |
Definition at line 400 of file platform.h.
using enable_if_t = typename std::enable_if<B, T>::type |
Definition at line 598 of file platform.h.
|
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 494 of file platform.h.
|
inline |
Definition at line 584 of file platform.h.
|
inline |
Definition at line 577 of file platform.h.
|
noexcept |
Return true if the architecture we are running on is big endian.
Definition at line 517 of file platform.h.
|
inline |
Definition at line 558 of file platform.h.
|
inline |
Definition at line 561 of file platform.h.
|
inline |
Definition at line 568 of file platform.h.
|
inline |
Definition at line 567 of file platform.h.
|
inline |
Definition at line 563 of file platform.h.
|
inline |
Definition at line 566 of file platform.h.
|
inline |
Definition at line 562 of file platform.h.
|
inline |
Definition at line 564 of file platform.h.
|
inline |
Definition at line 565 of file platform.h.
|
inline |
Definition at line 569 of file platform.h.
|
inline |
Definition at line 559 of file platform.h.
|
inline |
Definition at line 554 of file platform.h.
|
inline |
Definition at line 557 of file platform.h.
|
inline |
Definition at line 560 of file platform.h.
|
inline |
Definition at line 551 of file platform.h.
|
inline |
Definition at line 552 of file platform.h.
|
inline |
Definition at line 555 of file platform.h.
|
inline |
Definition at line 556 of file platform.h.
|
inline |
Definition at line 553 of file platform.h.
Retrieve cpuid flags into 'info'.
Definition at line 525 of file platform.h.
|
noexcept |
Return true if the architecture we are running on is little endian.
Definition at line 509 of file platform.h.