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 113 of file platform.h.
#define __has_cpp_attribute | ( | x | ) | 0 |
Definition at line 108 of file platform.h.
#define __has_include | ( | x | ) | 0 |
Definition at line 119 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 330 of file platform.h.
Definition at line 361 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 326 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 340 of file platform.h.
#define OIIO_ANY_CLANG 0 |
Definition at line 207 of file platform.h.
#define OIIO_APPLE_CLANG_VERSION 0 |
Definition at line 170 of file platform.h.
#define OIIO_CACHE_ALIGN OIIO_ALIGN(OIIO_CACHE_LINE_SIZE) |
Definition at line 369 of file platform.h.
#define OIIO_CACHE_LINE_SIZE 64 |
Definition at line 366 of file platform.h.
#define OIIO_CLANG_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 303 of file platform.h.
#define OIIO_CLANG_VERSION 0 |
Definition at line 156 of file platform.h.
#define OIIO_CONST_FUNC |
Definition at line 431 of file platform.h.
#define OIIO_CONSTEXPR constexpr |
Definition at line 98 of file platform.h.
#define OIIO_CONSTEXPR14 constexpr |
Definition at line 95 of file platform.h.
#define OIIO_CONSTEXPR_OR_CONST constexpr |
Definition at line 99 of file platform.h.
#define OIIO_DEPRECATED | ( | msg | ) |
Definition at line 466 of file platform.h.
#define OIIO_DEVICE |
Definition at line 530 of file platform.h.
#define OIIO_DEVICE_CONSTEXPR /*__host__*/ inline |
Definition at line 539 of file platform.h.
#define OIIO_ENABLE_IF | ( | ... | ) | OIIO::enable_if_t<(__VA_ARGS__), int> = 0 |
Definition at line 676 of file platform.h.
#define OIIO_FALLTHROUGH |
Definition at line 476 of file platform.h.
#define OIIO_FORCEINLINE inline |
Definition at line 403 of file platform.h.
#define OIIO_GCC_ONLY_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 302 of file platform.h.
#define OIIO_GCC_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 301 of file platform.h.
#define OIIO_GNUC_VERSION 0 |
Definition at line 146 of file platform.h.
#define OIIO_HOSTDEVICE |
Definition at line 529 of file platform.h.
#define OIIO_INTEL_CLANG_VERSION 0 |
Definition at line 199 of file platform.h.
#define OIIO_INTEL_CLASSIC_COMPILER_VERSION 0 |
Definition at line 178 of file platform.h.
#define OIIO_INTEL_LLVM_COMPILER 0 |
Definition at line 198 of file platform.h.
#define OIIO_INTEL_LLVM_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 305 of file platform.h.
#define OIIO_INTEL_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 304 of file platform.h.
Definition at line 387 of file platform.h.
#define OIIO_MAYBE_UNUSED |
Definition at line 441 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2013 0 |
Definition at line 228 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2015 0 |
Definition at line 230 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2017 0 |
Definition at line 232 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2019 0 |
Definition at line 234 of file platform.h.
#define OIIO_MSVS_AT_LEAST_2022 0 |
Definition at line 236 of file platform.h.
#define OIIO_MSVS_BEFORE_2013 0 |
Definition at line 229 of file platform.h.
#define OIIO_MSVS_BEFORE_2015 0 |
Definition at line 231 of file platform.h.
#define OIIO_MSVS_BEFORE_2017 0 |
Definition at line 233 of file platform.h.
#define OIIO_MSVS_BEFORE_2019 0 |
Definition at line 235 of file platform.h.
#define OIIO_MSVS_BEFORE_2022 0 |
Definition at line 237 of file platform.h.
#define OIIO_MSVS_PRAGMA | ( | UnQuotedPragma | ) |
Definition at line 306 of file platform.h.
#define OIIO_MSVS_VERSION 0 |
Definition at line 227 of file platform.h.
#define OIIO_NO_SANITIZE_ADDRESS |
Definition at line 498 of file platform.h.
#define OIIO_NO_SANITIZE_UNDEFINED |
Definition at line 509 of file platform.h.
#define OIIO_NODISCARD |
Definition at line 485 of file platform.h.
#define OIIO_NOEXCEPT noexcept |
Definition at line 102 of file platform.h.
#define OIIO_NON_INTEL_CLANG 0 |
Definition at line 186 of file platform.h.
#define OIIO_PRAGMA | ( | UnQuotedPragma | ) | _Pragma(#UnQuotedPragma) |
Definition at line 258 of file platform.h.
#define OIIO_PRAGMA_VISIBILITY_POP |
Definition at line 300 of file platform.h.
#define OIIO_PRAGMA_VISIBILITY_PUSH |
Definition at line 299 of file platform.h.
#define OIIO_PRAGMA_WARNING_POP |
Definition at line 298 of file platform.h.
#define OIIO_PRAGMA_WARNING_PUSH |
Definition at line 297 of file platform.h.
#define OIIO_PRETTY_FUNCTION __FUNCTION__ |
Definition at line 551 of file platform.h.
#define OIIO_PURE_FUNC |
Definition at line 417 of file platform.h.
#define OIIO_RESTRICT |
Definition at line 453 of file platform.h.
#define OIIO_RETURNS_NONNULL |
Definition at line 519 of file platform.h.
Definition at line 388 of file platform.h.
#define OIIO_UNUSED_OK OIIO_MAYBE_UNUSED |
Definition at line 445 of file platform.h.
using enable_if_t = typename std::enable_if<B, T>::type |
Definition at line 669 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 562 of file platform.h.
|
inline |
Definition at line 655 of file platform.h.
|
inline |
Definition at line 645 of file platform.h.
|
noexcept |
Return true if the architecture we are running on is big endian.
Definition at line 585 of file platform.h.
|
inline |
Definition at line 626 of file platform.h.
|
inline |
Definition at line 629 of file platform.h.
|
inline |
Definition at line 636 of file platform.h.
|
inline |
Definition at line 635 of file platform.h.
|
inline |
Definition at line 631 of file platform.h.
|
inline |
Definition at line 634 of file platform.h.
|
inline |
Definition at line 630 of file platform.h.
|
inline |
Definition at line 632 of file platform.h.
|
inline |
Definition at line 633 of file platform.h.
|
inline |
Definition at line 637 of file platform.h.
|
inline |
Definition at line 627 of file platform.h.
|
inline |
Definition at line 622 of file platform.h.
|
inline |
Definition at line 625 of file platform.h.
|
inline |
Definition at line 628 of file platform.h.
|
inline |
Definition at line 619 of file platform.h.
|
inline |
Definition at line 620 of file platform.h.
|
inline |
Definition at line 623 of file platform.h.
|
inline |
Definition at line 624 of file platform.h.
|
inline |
Definition at line 621 of file platform.h.
Retrieve cpuid flags into 'info'.
Definition at line 593 of file platform.h.
|
noexcept |
Return true if the architecture we are running on is little endian.
Definition at line 577 of file platform.h.