22#define ARRAY_COUNT(arr) (int)(sizeof((arr)) / sizeof(*(arr)))
24#if defined(__clang__) && defined(__has_cpp_attribute)
25 #if __has_cpp_attribute(clang::fallthrough)
26 #define SKCMS_FALLTHROUGH [[clang::fallthrough]]
29 #ifndef SKCMS_HAS_MUSTTAIL
45 #if __has_cpp_attribute(clang::musttail) && !__has_feature(memory_sanitizer) \
46 && !__has_feature(address_sanitizer) \
47 && !defined(__EMSCRIPTEN__) \
48 && !defined(__arm__) \
49 && !defined(__riscv) \
50 && !defined(__loongarch__) \
51 && !defined(_WIN32) && !defined(__SYMBIAN32__)
52 #define SKCMS_HAS_MUSTTAIL 1
57#ifndef SKCMS_FALLTHROUGH
58 #define SKCMS_FALLTHROUGH
60#ifndef SKCMS_HAS_MUSTTAIL
61 #define SKCMS_HAS_MUSTTAIL 0
65 #define SKCMS_MAYBE_UNUSED __attribute__((unused))
66 #pragma clang diagnostic ignored "-Wused-but-marked-unused"
67#elif defined(__GNUC__)
68 #define SKCMS_MAYBE_UNUSED __attribute__((unused))
69#elif defined(_MSC_VER)
70 #define SKCMS_MAYBE_UNUSED __pragma(warning(suppress:4100))
72 #define SKCMS_MAYBE_UNUSED
80#define SAFE_SIZEOF(x) ((uint64_t)sizeof(x))
83#define SAFE_FIXED_SIZE(type) ((uint64_t)offsetof(type, variable))
86#if !defined(SKCMS_PORTABLE) && !(defined(__clang__) || \
87 defined(__GNUC__) || \
88 (defined(__EMSCRIPTEN__) && defined(__wasm_simd128__)))
89 #define SKCMS_PORTABLE 1
94#if defined(SKCMS_PORTABLE) || !defined(__x86_64__) || defined(ANDROID) || defined(__ANDROID__)
95 #undef SKCMS_FORCE_HSW
96 #if !defined(SKCMS_DISABLE_HSW)
97 #define SKCMS_DISABLE_HSW 1
100 #undef SKCMS_FORCE_SKX
101 #if !defined(SKCMS_DISABLE_SKX)
102 #define SKCMS_DISABLE_SKX 1
130 float roundtrip = (
float)((
int)
x);
131 return roundtrip >
x ? roundtrip - 1 : roundtrip;
133static inline float fabsf_(
float x) {
return x < 0 ? -
x :
x; }
134float powf_(
float,
float);
bool skcms_GetTagBySignature(const skcms_ICCProfile *, uint32_t sig, skcms_ICCTag *)
void skcms_GetTagByIndex(const skcms_ICCProfile *, uint32_t idx, skcms_ICCTag *)
static float floorf_(float x)
const uint8_t skcms_252_random_bytes[252]
float powf_(float, float)
struct skcms_ICCTag skcms_ICCTag
static float fabsf_(float x)
float skcms_MaxRoundtripError(const skcms_Curve *curve, const skcms_TransferFunction *inv_tf)