From 70aee428563fac4da04d2e16f2998bbd3913dd85 Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 28 Jul 2026 00:42:40 +1000 Subject: [PATCH] Get the bar fixes --- Single-Header/dn_single_header.cpp | 354 +++++++++++++++-------------- Single-Header/dn_single_header.h | 14 +- Source/OS/dn_os_posix.cpp | 12 +- Source/dn.cpp | 340 +++++++++++++-------------- Source/dn.h | 12 +- 5 files changed, 378 insertions(+), 354 deletions(-) diff --git a/Single-Header/dn_single_header.cpp b/Single-Header/dn_single_header.cpp index 62d572b..7b7d832 100644 --- a/Single-Header/dn_single_header.cpp +++ b/Single-Header/dn_single_header.cpp @@ -1,4 +1,4 @@ -// Generated by the DN single header generator 2026-07-21 20:17:37 +// Generated by the DN single header generator 2026-07-28 00:41:28 // DN: Single header generator commented out => #if defined(_CLANGD) // #define DN_WITH_TESTS 1 @@ -3774,22 +3774,22 @@ DN_API DN_Str8 DN_Str8FileNameNoExtension(DN_Str8 path) DN_API DN_Str8 DN_Str8FilePathNoExtension(DN_Str8 path) { DN_Str8BSplitResult split = DN_Str8BSplitLast(path, DN_Str8Lit(".")); - DN_Str8 result = split.lhs; + DN_Str8 result = split.lhs; return result; } DN_API DN_Str8 DN_Str8FileExtension(DN_Str8 path) { DN_Str8BSplitResult split = DN_Str8BSplitLast(path, DN_Str8Lit(".")); - DN_Str8 result = split.rhs; + DN_Str8 result = split.rhs; return result; } DN_API DN_Str8 DN_Str8FileDirectoryFromPath(DN_Str8 path) { - DN_Str8 separators[] = {DN_Str8Lit("/"), DN_Str8Lit("\\")}; + DN_Str8 separators[] = {DN_Str8Lit("/"), DN_Str8Lit("\\")}; DN_Str8BSplitResult split = DN_Str8BSplitLastArray(path, separators, DN_ArrayCountU(separators)); - DN_Str8 result = split.lhs; + DN_Str8 result = split.rhs.count == 0 ? DN_Str8Lit(".") : split.lhs; return result; } @@ -5775,7 +5775,7 @@ static void DN_QSortInsertion_(void *array, DN_USize array_size, DN_USize elem_s DN_TcScratchEnd(&scratch); } -DN_API void DN_QSort(void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare) +DN_API void DN_QSort_(void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare) { if (!array || array_size <= 1 || elem_size == 0 || !compare) return; @@ -5801,7 +5801,7 @@ DN_API void DN_QSort(void *array, DN_USize array_size, DN_USize elem_size, void // 4^, 8, 7, 5, 2, 3, 6 if (compare(array_u8 + (start_index * elem_size), array_u8 + (pivot_index * elem_size), user_context)) - partition_index++; + partition_index++; start_index++; // 4, |8, 7, 5^, 2, 3, 6* @@ -5809,23 +5809,31 @@ DN_API void DN_QSort(void *array, DN_USize array_size, DN_USize elem_size, void // 4, 5, 2, |8, 7, ^3, 6* // 4, 5, 2, 3, |7, 8, ^6* for (DN_USize index = start_index; index < last_index; index++) { - if (compare(array_u8 + (index * elem_size), array_u8 + (pivot_index * elem_size), user_context)) { - DN_QSortSwapElems_(array, elem_size, partition_index, index); - partition_index++; - } + if (compare(array_u8 + (index * elem_size), array_u8 + (pivot_index * elem_size), user_context)) { + DN_QSortSwapElems_(array, elem_size, partition_index, index); + partition_index++; + } } // Move pivot to right of partition // 4, 5, 2, 3, |6, 8, ^7* DN_QSortSwapElems_(array, elem_size, partition_index, pivot_index); - DN_QSort(array_u8, partition_index, elem_size, user_context, compare); + DN_QSort_(array_u8, partition_index, elem_size, user_context, compare); // Skip the value at partion index since that is guaranteed to be sorted. // 4, 5, 2, 3, (x), 8, 7 DN_USize one_after_partition_index = partition_index + 1; - DN_QSort(array_u8 + (one_after_partition_index * elem_size), (array_size - one_after_partition_index), elem_size, user_context, compare); + DN_QSort_(array_u8 + (one_after_partition_index * elem_size), (array_size - one_after_partition_index), elem_size, user_context, compare); } +#if defined(__cplusplus) +template +DN_API void DN_QSort(T *array, DN_USize array_size, void *user_context, DN_QSortCompareFunc *compare) +{ + DN_QSort_(array, array_size, sizeof(T), user_context, compare); +} +#endif + DN_API bool DN_QSortCompareStr8NaturalAsc(void const* lhs, void const *rhs, void *user_context) { DN_Str8EqCase eq_case = *DN_Cast(DN_Str8EqCase *) user_context; @@ -5878,32 +5886,32 @@ DN_API bool DN_QSortCompareBytesGT(void const* lhs, void const *rhs, void *user_ DN_API void DN_QSortBytesLT(void *array, DN_USize array_size, DN_USize elem_size) { - DN_QSort(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesLT); + DN_QSort_(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesLT); } DN_API void DN_QSortBytesGT(void *array, DN_USize array_size, DN_USize elem_size) { - DN_QSort(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesGT); + DN_QSort_(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesGT); } DN_API void DN_QSortStr8NaturalAsc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalAsc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalAsc); } DN_API void DN_QSortStr8NaturalDesc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalDesc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalDesc); } DN_API void DN_QSortStr8LexicographicAsc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicAsc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicAsc); } DN_API void DN_QSortStr8LexicographicDesc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicDesc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicDesc); } DN_API bool DN_BSearchLessThanBytes(void const *lhs, void const *rhs, void *user_context) @@ -6069,11 +6077,11 @@ DN_API DN_U64 DN_Fnv1aHashU64FromBytes(void const *bytes, DN_USize count, DN_U64 } #if defined(DN_COMPILER_MSVC) || defined(DN_COMPILER_CLANG_CL) - #define DN_MMH3_ROTL32(x, y) _rotl(x, y) - #define DN_MMH3_ROTL64(x, y) _rotl64(x, y) + #define DN_MMH3_ROTL32(x, y) _rotl(x, y) + #define DN_MMH3_ROTL64(x, y) _rotl64(x, y) #else - #define DN_MMH3_ROTL32(x, y) ((x) << (y)) | ((x) >> (32 - (y))) - #define DN_MMH3_ROTL64(x, y) ((x) << (y)) | ((x) >> (64 - (y))) + #define DN_MMH3_ROTL32(x, y) ((x) << (y)) | ((x) >> (32 - (y))) + #define DN_MMH3_ROTL64(x, y) ((x) << (y)) | ((x) >> (64 - (y))) #endif //----------------------------------------------------------------------------- @@ -6094,206 +6102,202 @@ DN_FORCE_INLINE DN_U64 DN_Murmur3GetBlock64_(DN_U64 const *p, int i) DN_FORCE_INLINE DN_U32 DN_Murmur3FMix32_(DN_U32 h) { - h ^= h >> 16; - h *= 0x85ebca6b; - h ^= h >> 13; - h *= 0xc2b2ae35; - h ^= h >> 16; - return h; + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + return h; } DN_FORCE_INLINE DN_U64 DN_Murmur3FMix64_(DN_U64 k) { - k ^= k >> 33; - k *= 0xff51afd7ed558ccd; - k ^= k >> 33; - k *= 0xc4ceb9fe1a85ec53; - k ^= k >> 33; - return k; + k ^= k >> 33; + k *= 0xff51afd7ed558ccd; + k ^= k >> 33; + k *= 0xc4ceb9fe1a85ec53; + k ^= k >> 33; + return k; } -DN_API DN_U32 DN_Murmur3HashU128FromBytesX86(void const *bytes, int len, DN_U32 seed) +DN_API DN_U32 DN_Murmur3HashU32FromBytesX86(void const *bytes, int len, DN_U32 seed) { - const DN_U8 *data = (const DN_U8 *)bytes; - const int nblocks = len / 4; + const DN_U8 *data = (const DN_U8 *)bytes; + const int nblocks = len / 4; - DN_U32 h1 = seed; + DN_U32 h1 = seed; - const DN_U32 c1 = 0xcc9e2d51; - const DN_U32 c2 = 0x1b873593; + const DN_U32 c1 = 0xcc9e2d51; + const DN_U32 c2 = 0x1b873593; - //---------- - // body + //---------- + // body - const DN_U32 *blocks = (const DN_U32 *)(data + nblocks * 4); + const DN_U32 *blocks = (const DN_U32 *)(data + nblocks * 4); - for (int i = -nblocks; i; i++) - { - DN_U32 k1 = DN_Murmur3GetBlock32_(blocks, i); + for (int i = -nblocks; i; i++) { + DN_U32 k1 = DN_Murmur3GetBlock32_(blocks, i); + k1 *= c1; + k1 = DN_MMH3_ROTL32(k1, 15); + k1 *= c2; + + h1 ^= k1; + h1 = DN_MMH3_ROTL32(h1, 13); + h1 = h1 * 5 + 0xe6546b64; + } + + //---------- + // tail + + const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 4); + + DN_U32 k1 = 0; + + switch (len & 3) { + case 3: + k1 ^= tail[2] << 16; + case 2: + k1 ^= tail[1] << 8; + case 1: + k1 ^= tail[0]; k1 *= c1; k1 = DN_MMH3_ROTL32(k1, 15); k1 *= c2; - h1 ^= k1; - h1 = DN_MMH3_ROTL32(h1, 13); - h1 = h1 * 5 + 0xe6546b64; - } + }; - //---------- - // tail + //---------- + // finalization - const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 4); + h1 ^= len; - DN_U32 k1 = 0; + h1 = DN_Murmur3FMix32_(h1); - switch (len & 3) - { - case 3: - k1 ^= tail[2] << 16; - case 2: - k1 ^= tail[1] << 8; - case 1: - k1 ^= tail[0]; - k1 *= c1; - k1 = DN_MMH3_ROTL32(k1, 15); - k1 *= c2; - h1 ^= k1; - }; - - //---------- - // finalization - - h1 ^= len; - - h1 = DN_Murmur3FMix32_(h1); - - return h1; + return h1; } DN_API DN_Murmur3 DN_Murmur3HashU128FromBytesX64(void const *bytes, int len, DN_U32 seed) { - const DN_U8 *data = (const DN_U8 *)bytes; - const int nblocks = len / 16; + const DN_U8 *data = (const DN_U8 *)bytes; + const int nblocks = len / 16; - DN_U64 h1 = seed; - DN_U64 h2 = seed; + DN_U64 h1 = seed; + DN_U64 h2 = seed; - const DN_U64 c1 = 0x87c37b91114253d5; - const DN_U64 c2 = 0x4cf5ad432745937f; + const DN_U64 c1 = 0x87c37b91114253d5; + const DN_U64 c2 = 0x4cf5ad432745937f; - //---------- - // body + //---------- + // body - const DN_U64 *blocks = (const DN_U64 *)(data); + const DN_U64 *blocks = (const DN_U64 *)(data); - for (int i = 0; i < nblocks; i++) - { - DN_U64 k1 = DN_Murmur3GetBlock64_(blocks, i * 2 + 0); - DN_U64 k2 = DN_Murmur3GetBlock64_(blocks, i * 2 + 1); + for (int i = 0; i < nblocks; i++) { + DN_U64 k1 = DN_Murmur3GetBlock64_(blocks, i * 2 + 0); + DN_U64 k2 = DN_Murmur3GetBlock64_(blocks, i * 2 + 1); - k1 *= c1; - k1 = DN_MMH3_ROTL64(k1, 31); - k1 *= c2; - h1 ^= k1; + k1 *= c1; + k1 = DN_MMH3_ROTL64(k1, 31); + k1 *= c2; + h1 ^= k1; - h1 = DN_MMH3_ROTL64(h1, 27); - h1 += h2; - h1 = h1 * 5 + 0x52dce729; + h1 = DN_MMH3_ROTL64(h1, 27); + h1 += h2; + h1 = h1 * 5 + 0x52dce729; + k2 *= c2; + k2 = DN_MMH3_ROTL64(k2, 33); + k2 *= c1; + h2 ^= k2; + + h2 = DN_MMH3_ROTL64(h2, 31); + h2 += h1; + h2 = h2 * 5 + 0x38495ab5; + } + + //---------- + // tail + + const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 16); + + DN_U64 k1 = 0; + DN_U64 k2 = 0; + + switch (len & 15) { + case 15: + k2 ^= ((DN_U64)tail[14]) << 48; + case 14: + k2 ^= ((DN_U64)tail[13]) << 40; + case 13: + k2 ^= ((DN_U64)tail[12]) << 32; + case 12: + k2 ^= ((DN_U64)tail[11]) << 24; + case 11: + k2 ^= ((DN_U64)tail[10]) << 16; + case 10: + k2 ^= ((DN_U64)tail[9]) << 8; + case 9: + k2 ^= ((DN_U64)tail[8]) << 0; k2 *= c2; k2 = DN_MMH3_ROTL64(k2, 33); k2 *= c1; h2 ^= k2; - h2 = DN_MMH3_ROTL64(h2, 31); - h2 += h1; - h2 = h2 * 5 + 0x38495ab5; - } + case 8: + k1 ^= ((DN_U64)tail[7]) << 56; + case 7: + k1 ^= ((DN_U64)tail[6]) << 48; + case 6: + k1 ^= ((DN_U64)tail[5]) << 40; + case 5: + k1 ^= ((DN_U64)tail[4]) << 32; + case 4: + k1 ^= ((DN_U64)tail[3]) << 24; + case 3: + k1 ^= ((DN_U64)tail[2]) << 16; + case 2: + k1 ^= ((DN_U64)tail[1]) << 8; + case 1: + k1 ^= ((DN_U64)tail[0]) << 0; + k1 *= c1; + k1 = DN_MMH3_ROTL64(k1, 31); + k1 *= c2; + h1 ^= k1; + }; - //---------- - // tail + //---------- + // finalization - const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 16); + h1 ^= len; + h2 ^= len; - DN_U64 k1 = 0; - DN_U64 k2 = 0; + h1 += h2; + h2 += h1; - switch (len & 15) - { - case 15: - k2 ^= ((DN_U64)tail[14]) << 48; - case 14: - k2 ^= ((DN_U64)tail[13]) << 40; - case 13: - k2 ^= ((DN_U64)tail[12]) << 32; - case 12: - k2 ^= ((DN_U64)tail[11]) << 24; - case 11: - k2 ^= ((DN_U64)tail[10]) << 16; - case 10: - k2 ^= ((DN_U64)tail[9]) << 8; - case 9: - k2 ^= ((DN_U64)tail[8]) << 0; - k2 *= c2; - k2 = DN_MMH3_ROTL64(k2, 33); - k2 *= c1; - h2 ^= k2; + h1 = DN_Murmur3FMix64_(h1); + h2 = DN_Murmur3FMix64_(h2); - case 8: - k1 ^= ((DN_U64)tail[7]) << 56; - case 7: - k1 ^= ((DN_U64)tail[6]) << 48; - case 6: - k1 ^= ((DN_U64)tail[5]) << 40; - case 5: - k1 ^= ((DN_U64)tail[4]) << 32; - case 4: - k1 ^= ((DN_U64)tail[3]) << 24; - case 3: - k1 ^= ((DN_U64)tail[2]) << 16; - case 2: - k1 ^= ((DN_U64)tail[1]) << 8; - case 1: - k1 ^= ((DN_U64)tail[0]) << 0; - k1 *= c1; - k1 = DN_MMH3_ROTL64(k1, 31); - k1 *= c2; - h1 ^= k1; - }; + h1 += h2; + h2 += h1; - //---------- - // finalization - - h1 ^= len; - h2 ^= len; - - h1 += h2; - h2 += h1; - - h1 = DN_Murmur3FMix64_(h1); - h2 = DN_Murmur3FMix64_(h2); - - h1 += h2; - h2 += h1; - - DN_Murmur3 result = {}; - result.e[0] = h1; - result.e[1] = h2; - return result; + DN_Murmur3 result = {}; + result.e[0] = h1; + result.e[1] = h2; + return result; } DN_API DN_U64 DN_Murmur3HashU64FromBytesX64(void const *bytes, int len, DN_U32 seed) { DN_Murmur3 hash = DN_Murmur3HashU128FromBytesX64(bytes, len, seed); - DN_U64 result = hash.e[0]; + DN_U64 result = hash.e[0]; return result; } DN_API DN_U32 DN_Murmur3HashU32FromBytesX64(void const *bytes, int len, DN_U32 seed) { DN_Murmur3 hash = DN_Murmur3HashU128FromBytesX64(bytes, len, seed); - DN_U32 result = DN_Cast(DN_U32)hash.e[0]; + DN_U32 result = DN_Cast(DN_U32)hash.e[0]; return result; } @@ -7392,7 +7396,7 @@ DN_API DN_V4F32 DN_V4F32Linear01FromSrgb01(DN_V4F32 srgb01) DN_API DN_V4F32 DN_V4F32Linear01Desaturate(DN_V4F32 linear01, DN_F32 t01) { - DN_F32 luminance = (linear01.r * DN_V3F32_Rgb_LUMINANCE.r) + (linear01.g * DN_V3F32_Rgb_LUMINANCE.g) + (linear01.b * DN_V3F32_Rgb_LUMINANCE.b); + DN_F32 luminance = (linear01.r * DN_V3F32_RGB_LUMINANCE.r) + (linear01.g * DN_V3F32_RGB_LUMINANCE.g) + (linear01.b * DN_V3F32_RGB_LUMINANCE.b); DN_V4F32 result = linear01; result.rgb = DN_V3F32Lerp(result.rgb, t01, DN_V3F32From1N(luminance)); return result; @@ -14605,25 +14609,25 @@ DN_API DN_OSPosixProcSelfStatus DN_OS_PosixProcSelfStatus() for (DN_ForItSize(line_it, DN_Str8, lines.data, lines.count)) { DN_Str8 line = DN_Str8TrimWhitespaceAround(*line_it.data); - if (DN_Str8StartsWith(line, NAME, DN_Str8EqCase_Insensitive)) { + if (DN_Str8StartsWithInsensitive(line, NAME)) { DN_Str8 str8 = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, NAME.count, line.count)); result.name_size = DN_Min(str8.count, sizeof(result.name)); DN_Memcpy(result.name, str8.data, result.name_size); - } else if (DN_Str8StartsWith(line, PID, DN_Str8EqCase_Insensitive)) { + } else if (DN_Str8StartsWithInsensitive(line, PID)) { DN_Str8 str8 = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, PID.count, line.count)); DN_U64FromResult to_u64 = DN_U64FromStr8(str8); result.pid = to_u64.value; DN_Assert(to_u64.success); - } else if (DN_Str8StartsWith(line, VM_SIZE, DN_Str8EqCase_Insensitive)) { + } else if (DN_Str8StartsWithInsensitive(line, VM_SIZE)) { DN_Str8 size_with_kb = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, VM_SIZE.count, line.count)); - DN_Assert(DN_Str8EndsWith(size_with_kb, DN_Str8Lit("kB"))); + DN_Assert(DN_Str8EndsWithSensitive(size_with_kb, DN_Str8Lit("kB"))); DN_Str8 vm_size = DN_Str8BSplit(size_with_kb, DN_Str8Lit(" ")).lhs; DN_U64FromResult to_u64 = DN_U64FromStr8(vm_size); result.vm_size = DN_Kilobytes(to_u64.value); DN_Assert(to_u64.success); - } else if (DN_Str8StartsWith(line, VM_PEAK, DN_Str8EqCase_Insensitive)) { + } else if (DN_Str8StartsWithInsensitive(line, VM_PEAK)) { DN_Str8 size_with_kb = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, VM_PEAK.count, line.count)); - DN_Assert(DN_Str8EndsWith(size_with_kb, DN_Str8Lit("kB"))); + DN_Assert(DN_Str8EndsWithSensitive(size_with_kb, DN_Str8Lit("kB"))); DN_Str8 vm_size = DN_Str8BSplit(size_with_kb, DN_Str8Lit(" ")).lhs; DN_U64FromResult to_u64 = DN_U64FromStr8(vm_size); result.vm_peak = DN_Kilobytes(to_u64.value); diff --git a/Single-Header/dn_single_header.h b/Single-Header/dn_single_header.h index 5480bad..465d863 100644 --- a/Single-Header/dn_single_header.h +++ b/Single-Header/dn_single_header.h @@ -1,4 +1,4 @@ -// Generated by the DN single header generator 2026-07-21 20:17:37 +// Generated by the DN single header generator 2026-07-28 00:41:27 #if !defined(DN_H) #define DN_H @@ -302,6 +302,7 @@ // NOTE: Platform identification #if !defined(DN_PLATFORM_EMSCRIPTEN) && \ !defined(DN_PLATFORM_POSIX) && \ + !defined(DN_PLATFORM_ARM64) && \ !defined(DN_PLATFORM_WIN32) #if defined(__aarch64__) || defined(_M_ARM64) #define DN_PLATFORM_ARM64 @@ -5249,7 +5250,14 @@ DN_API void DN_ProfilerFmtToStdout DN_API DN_F64 DN_ProfilerSecFromTsc (DN_Profiler *profiler, DN_U64 duration_tsc); DN_API DN_F64 DN_ProfilerMsFromTsc (DN_Profiler *profiler, DN_U64 duration_tsc); -DN_API void DN_QSort (void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare); +DN_API void DN_QSort_ (void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare); +#if defined(__cplusplus) +template void DN_QSortT (T *array, DN_USize array_size, void *user_context, DN_QSortCompareFunc *compare); +#define DN_QSort(array, array_size, user_context, compare) DN_QSortT(array, array_size, user_context, compare) +#else +#define DN_QSort(array, array_size, user_context, compare) DN_QSort_(array, array_size, sizeof(*array), user_context, compare) +#endif + DN_API bool DN_QSortCompareStr8NaturalAsc (void const* lhs, void const *rhs, void *user_context); DN_API bool DN_QSortCompareStr8NaturalDesc (void const* lhs, void const *rhs, void *user_context); DN_API bool DN_QSortCompareStr8LexicographicAsc (void const* lhs, void const *rhs, void *user_context); @@ -5510,7 +5518,7 @@ DN_API DN_F32 DN_V2F32Area // NOTE: Grayscale co-efficients from: // https://github.com/EpicGames/UnrealEngine/blob/260bb2e1c5610b31c63a36206eedd289409c5f11/Engine/Source/Runtime/Core/Private/Math/Color.cpp#L304 -DN_V3F32 static const DN_V3F32_Rgb_LUMINANCE = DN_V3F32From3N(0.3f, 0.59f, 0.11f); +DN_V3F32 static const DN_V3F32_RGB_LUMINANCE = DN_V3F32From3N(0.3f, 0.59f, 0.11f); DN_API bool operator== (DN_V3F32 lhs, DN_V3F32 rhs); DN_API bool operator!= (DN_V3F32 lhs, DN_V3F32 rhs); diff --git a/Source/OS/dn_os_posix.cpp b/Source/OS/dn_os_posix.cpp index 0a84cba..38af509 100644 --- a/Source/OS/dn_os_posix.cpp +++ b/Source/OS/dn_os_posix.cpp @@ -1414,25 +1414,25 @@ DN_API DN_OSPosixProcSelfStatus DN_OS_PosixProcSelfStatus() for (DN_ForItSize(line_it, DN_Str8, lines.data, lines.count)) { DN_Str8 line = DN_Str8TrimWhitespaceAround(*line_it.data); - if (DN_Str8StartsWith(line, NAME, DN_Str8EqCase_Insensitive)) { + if (DN_Str8StartsWithInsensitive(line, NAME)) { DN_Str8 str8 = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, NAME.count, line.count)); result.name_size = DN_Min(str8.count, sizeof(result.name)); DN_Memcpy(result.name, str8.data, result.name_size); - } else if (DN_Str8StartsWith(line, PID, DN_Str8EqCase_Insensitive)) { + } else if (DN_Str8StartsWithInsensitive(line, PID)) { DN_Str8 str8 = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, PID.count, line.count)); DN_U64FromResult to_u64 = DN_U64FromStr8(str8); result.pid = to_u64.value; DN_Assert(to_u64.success); - } else if (DN_Str8StartsWith(line, VM_SIZE, DN_Str8EqCase_Insensitive)) { + } else if (DN_Str8StartsWithInsensitive(line, VM_SIZE)) { DN_Str8 size_with_kb = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, VM_SIZE.count, line.count)); - DN_Assert(DN_Str8EndsWith(size_with_kb, DN_Str8Lit("kB"))); + DN_Assert(DN_Str8EndsWithSensitive(size_with_kb, DN_Str8Lit("kB"))); DN_Str8 vm_size = DN_Str8BSplit(size_with_kb, DN_Str8Lit(" ")).lhs; DN_U64FromResult to_u64 = DN_U64FromStr8(vm_size); result.vm_size = DN_Kilobytes(to_u64.value); DN_Assert(to_u64.success); - } else if (DN_Str8StartsWith(line, VM_PEAK, DN_Str8EqCase_Insensitive)) { + } else if (DN_Str8StartsWithInsensitive(line, VM_PEAK)) { DN_Str8 size_with_kb = DN_Str8TrimWhitespaceAround(DN_Str8Subset(line, VM_PEAK.count, line.count)); - DN_Assert(DN_Str8EndsWith(size_with_kb, DN_Str8Lit("kB"))); + DN_Assert(DN_Str8EndsWithSensitive(size_with_kb, DN_Str8Lit("kB"))); DN_Str8 vm_size = DN_Str8BSplit(size_with_kb, DN_Str8Lit(" ")).lhs; DN_U64FromResult to_u64 = DN_U64FromStr8(vm_size); result.vm_peak = DN_Kilobytes(to_u64.value); diff --git a/Source/dn.cpp b/Source/dn.cpp index 861d73b..52969d6 100644 --- a/Source/dn.cpp +++ b/Source/dn.cpp @@ -3772,22 +3772,22 @@ DN_API DN_Str8 DN_Str8FileNameNoExtension(DN_Str8 path) DN_API DN_Str8 DN_Str8FilePathNoExtension(DN_Str8 path) { DN_Str8BSplitResult split = DN_Str8BSplitLast(path, DN_Str8Lit(".")); - DN_Str8 result = split.lhs; + DN_Str8 result = split.lhs; return result; } DN_API DN_Str8 DN_Str8FileExtension(DN_Str8 path) { DN_Str8BSplitResult split = DN_Str8BSplitLast(path, DN_Str8Lit(".")); - DN_Str8 result = split.rhs; + DN_Str8 result = split.rhs; return result; } DN_API DN_Str8 DN_Str8FileDirectoryFromPath(DN_Str8 path) { - DN_Str8 separators[] = {DN_Str8Lit("/"), DN_Str8Lit("\\")}; + DN_Str8 separators[] = {DN_Str8Lit("/"), DN_Str8Lit("\\")}; DN_Str8BSplitResult split = DN_Str8BSplitLastArray(path, separators, DN_ArrayCountU(separators)); - DN_Str8 result = split.lhs; + DN_Str8 result = split.rhs.count == 0 ? DN_Str8Lit(".") : split.lhs; return result; } @@ -5773,7 +5773,7 @@ static void DN_QSortInsertion_(void *array, DN_USize array_size, DN_USize elem_s DN_TcScratchEnd(&scratch); } -DN_API void DN_QSort(void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare) +DN_API void DN_QSort_(void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare) { if (!array || array_size <= 1 || elem_size == 0 || !compare) return; @@ -5799,7 +5799,7 @@ DN_API void DN_QSort(void *array, DN_USize array_size, DN_USize elem_size, void // 4^, 8, 7, 5, 2, 3, 6 if (compare(array_u8 + (start_index * elem_size), array_u8 + (pivot_index * elem_size), user_context)) - partition_index++; + partition_index++; start_index++; // 4, |8, 7, 5^, 2, 3, 6* @@ -5807,23 +5807,31 @@ DN_API void DN_QSort(void *array, DN_USize array_size, DN_USize elem_size, void // 4, 5, 2, |8, 7, ^3, 6* // 4, 5, 2, 3, |7, 8, ^6* for (DN_USize index = start_index; index < last_index; index++) { - if (compare(array_u8 + (index * elem_size), array_u8 + (pivot_index * elem_size), user_context)) { - DN_QSortSwapElems_(array, elem_size, partition_index, index); - partition_index++; - } + if (compare(array_u8 + (index * elem_size), array_u8 + (pivot_index * elem_size), user_context)) { + DN_QSortSwapElems_(array, elem_size, partition_index, index); + partition_index++; + } } // Move pivot to right of partition // 4, 5, 2, 3, |6, 8, ^7* DN_QSortSwapElems_(array, elem_size, partition_index, pivot_index); - DN_QSort(array_u8, partition_index, elem_size, user_context, compare); + DN_QSort_(array_u8, partition_index, elem_size, user_context, compare); // Skip the value at partion index since that is guaranteed to be sorted. // 4, 5, 2, 3, (x), 8, 7 DN_USize one_after_partition_index = partition_index + 1; - DN_QSort(array_u8 + (one_after_partition_index * elem_size), (array_size - one_after_partition_index), elem_size, user_context, compare); + DN_QSort_(array_u8 + (one_after_partition_index * elem_size), (array_size - one_after_partition_index), elem_size, user_context, compare); } +#if defined(__cplusplus) +template +DN_API void DN_QSort(T *array, DN_USize array_size, void *user_context, DN_QSortCompareFunc *compare) +{ + DN_QSort_(array, array_size, sizeof(T), user_context, compare); +} +#endif + DN_API bool DN_QSortCompareStr8NaturalAsc(void const* lhs, void const *rhs, void *user_context) { DN_Str8EqCase eq_case = *DN_Cast(DN_Str8EqCase *) user_context; @@ -5876,32 +5884,32 @@ DN_API bool DN_QSortCompareBytesGT(void const* lhs, void const *rhs, void *user_ DN_API void DN_QSortBytesLT(void *array, DN_USize array_size, DN_USize elem_size) { - DN_QSort(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesLT); + DN_QSort_(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesLT); } DN_API void DN_QSortBytesGT(void *array, DN_USize array_size, DN_USize elem_size) { - DN_QSort(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesGT); + DN_QSort_(array, array_size, elem_size, &elem_size, DN_QSortCompareBytesGT); } DN_API void DN_QSortStr8NaturalAsc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalAsc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalAsc); } DN_API void DN_QSortStr8NaturalDesc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalDesc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8NaturalDesc); } DN_API void DN_QSortStr8LexicographicAsc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicAsc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicAsc); } DN_API void DN_QSortStr8LexicographicDesc(DN_Str8 *array, DN_USize array_size, DN_Str8EqCase eq_case) { - DN_QSort(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicDesc); + DN_QSort_(array, array_size, sizeof(*array), /*user_context=*/ &eq_case, DN_QSortCompareStr8LexicographicDesc); } DN_API bool DN_BSearchLessThanBytes(void const *lhs, void const *rhs, void *user_context) @@ -6067,11 +6075,11 @@ DN_API DN_U64 DN_Fnv1aHashU64FromBytes(void const *bytes, DN_USize count, DN_U64 } #if defined(DN_COMPILER_MSVC) || defined(DN_COMPILER_CLANG_CL) - #define DN_MMH3_ROTL32(x, y) _rotl(x, y) - #define DN_MMH3_ROTL64(x, y) _rotl64(x, y) + #define DN_MMH3_ROTL32(x, y) _rotl(x, y) + #define DN_MMH3_ROTL64(x, y) _rotl64(x, y) #else - #define DN_MMH3_ROTL32(x, y) ((x) << (y)) | ((x) >> (32 - (y))) - #define DN_MMH3_ROTL64(x, y) ((x) << (y)) | ((x) >> (64 - (y))) + #define DN_MMH3_ROTL32(x, y) ((x) << (y)) | ((x) >> (32 - (y))) + #define DN_MMH3_ROTL64(x, y) ((x) << (y)) | ((x) >> (64 - (y))) #endif //----------------------------------------------------------------------------- @@ -6092,206 +6100,202 @@ DN_FORCE_INLINE DN_U64 DN_Murmur3GetBlock64_(DN_U64 const *p, int i) DN_FORCE_INLINE DN_U32 DN_Murmur3FMix32_(DN_U32 h) { - h ^= h >> 16; - h *= 0x85ebca6b; - h ^= h >> 13; - h *= 0xc2b2ae35; - h ^= h >> 16; - return h; + h ^= h >> 16; + h *= 0x85ebca6b; + h ^= h >> 13; + h *= 0xc2b2ae35; + h ^= h >> 16; + return h; } DN_FORCE_INLINE DN_U64 DN_Murmur3FMix64_(DN_U64 k) { - k ^= k >> 33; - k *= 0xff51afd7ed558ccd; - k ^= k >> 33; - k *= 0xc4ceb9fe1a85ec53; - k ^= k >> 33; - return k; + k ^= k >> 33; + k *= 0xff51afd7ed558ccd; + k ^= k >> 33; + k *= 0xc4ceb9fe1a85ec53; + k ^= k >> 33; + return k; } -DN_API DN_U32 DN_Murmur3HashU128FromBytesX86(void const *bytes, int len, DN_U32 seed) +DN_API DN_U32 DN_Murmur3HashU32FromBytesX86(void const *bytes, int len, DN_U32 seed) { - const DN_U8 *data = (const DN_U8 *)bytes; - const int nblocks = len / 4; + const DN_U8 *data = (const DN_U8 *)bytes; + const int nblocks = len / 4; - DN_U32 h1 = seed; + DN_U32 h1 = seed; - const DN_U32 c1 = 0xcc9e2d51; - const DN_U32 c2 = 0x1b873593; + const DN_U32 c1 = 0xcc9e2d51; + const DN_U32 c2 = 0x1b873593; - //---------- - // body + //---------- + // body - const DN_U32 *blocks = (const DN_U32 *)(data + nblocks * 4); + const DN_U32 *blocks = (const DN_U32 *)(data + nblocks * 4); - for (int i = -nblocks; i; i++) - { - DN_U32 k1 = DN_Murmur3GetBlock32_(blocks, i); + for (int i = -nblocks; i; i++) { + DN_U32 k1 = DN_Murmur3GetBlock32_(blocks, i); + k1 *= c1; + k1 = DN_MMH3_ROTL32(k1, 15); + k1 *= c2; + + h1 ^= k1; + h1 = DN_MMH3_ROTL32(h1, 13); + h1 = h1 * 5 + 0xe6546b64; + } + + //---------- + // tail + + const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 4); + + DN_U32 k1 = 0; + + switch (len & 3) { + case 3: + k1 ^= tail[2] << 16; + case 2: + k1 ^= tail[1] << 8; + case 1: + k1 ^= tail[0]; k1 *= c1; k1 = DN_MMH3_ROTL32(k1, 15); k1 *= c2; - h1 ^= k1; - h1 = DN_MMH3_ROTL32(h1, 13); - h1 = h1 * 5 + 0xe6546b64; - } + }; - //---------- - // tail + //---------- + // finalization - const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 4); + h1 ^= len; - DN_U32 k1 = 0; + h1 = DN_Murmur3FMix32_(h1); - switch (len & 3) - { - case 3: - k1 ^= tail[2] << 16; - case 2: - k1 ^= tail[1] << 8; - case 1: - k1 ^= tail[0]; - k1 *= c1; - k1 = DN_MMH3_ROTL32(k1, 15); - k1 *= c2; - h1 ^= k1; - }; - - //---------- - // finalization - - h1 ^= len; - - h1 = DN_Murmur3FMix32_(h1); - - return h1; + return h1; } DN_API DN_Murmur3 DN_Murmur3HashU128FromBytesX64(void const *bytes, int len, DN_U32 seed) { - const DN_U8 *data = (const DN_U8 *)bytes; - const int nblocks = len / 16; + const DN_U8 *data = (const DN_U8 *)bytes; + const int nblocks = len / 16; - DN_U64 h1 = seed; - DN_U64 h2 = seed; + DN_U64 h1 = seed; + DN_U64 h2 = seed; - const DN_U64 c1 = 0x87c37b91114253d5; - const DN_U64 c2 = 0x4cf5ad432745937f; + const DN_U64 c1 = 0x87c37b91114253d5; + const DN_U64 c2 = 0x4cf5ad432745937f; - //---------- - // body + //---------- + // body - const DN_U64 *blocks = (const DN_U64 *)(data); + const DN_U64 *blocks = (const DN_U64 *)(data); - for (int i = 0; i < nblocks; i++) - { - DN_U64 k1 = DN_Murmur3GetBlock64_(blocks, i * 2 + 0); - DN_U64 k2 = DN_Murmur3GetBlock64_(blocks, i * 2 + 1); + for (int i = 0; i < nblocks; i++) { + DN_U64 k1 = DN_Murmur3GetBlock64_(blocks, i * 2 + 0); + DN_U64 k2 = DN_Murmur3GetBlock64_(blocks, i * 2 + 1); - k1 *= c1; - k1 = DN_MMH3_ROTL64(k1, 31); - k1 *= c2; - h1 ^= k1; + k1 *= c1; + k1 = DN_MMH3_ROTL64(k1, 31); + k1 *= c2; + h1 ^= k1; - h1 = DN_MMH3_ROTL64(h1, 27); - h1 += h2; - h1 = h1 * 5 + 0x52dce729; + h1 = DN_MMH3_ROTL64(h1, 27); + h1 += h2; + h1 = h1 * 5 + 0x52dce729; + k2 *= c2; + k2 = DN_MMH3_ROTL64(k2, 33); + k2 *= c1; + h2 ^= k2; + + h2 = DN_MMH3_ROTL64(h2, 31); + h2 += h1; + h2 = h2 * 5 + 0x38495ab5; + } + + //---------- + // tail + + const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 16); + + DN_U64 k1 = 0; + DN_U64 k2 = 0; + + switch (len & 15) { + case 15: + k2 ^= ((DN_U64)tail[14]) << 48; + case 14: + k2 ^= ((DN_U64)tail[13]) << 40; + case 13: + k2 ^= ((DN_U64)tail[12]) << 32; + case 12: + k2 ^= ((DN_U64)tail[11]) << 24; + case 11: + k2 ^= ((DN_U64)tail[10]) << 16; + case 10: + k2 ^= ((DN_U64)tail[9]) << 8; + case 9: + k2 ^= ((DN_U64)tail[8]) << 0; k2 *= c2; k2 = DN_MMH3_ROTL64(k2, 33); k2 *= c1; h2 ^= k2; - h2 = DN_MMH3_ROTL64(h2, 31); - h2 += h1; - h2 = h2 * 5 + 0x38495ab5; - } + case 8: + k1 ^= ((DN_U64)tail[7]) << 56; + case 7: + k1 ^= ((DN_U64)tail[6]) << 48; + case 6: + k1 ^= ((DN_U64)tail[5]) << 40; + case 5: + k1 ^= ((DN_U64)tail[4]) << 32; + case 4: + k1 ^= ((DN_U64)tail[3]) << 24; + case 3: + k1 ^= ((DN_U64)tail[2]) << 16; + case 2: + k1 ^= ((DN_U64)tail[1]) << 8; + case 1: + k1 ^= ((DN_U64)tail[0]) << 0; + k1 *= c1; + k1 = DN_MMH3_ROTL64(k1, 31); + k1 *= c2; + h1 ^= k1; + }; - //---------- - // tail + //---------- + // finalization - const DN_U8 *tail = (const DN_U8 *)(data + nblocks * 16); + h1 ^= len; + h2 ^= len; - DN_U64 k1 = 0; - DN_U64 k2 = 0; + h1 += h2; + h2 += h1; - switch (len & 15) - { - case 15: - k2 ^= ((DN_U64)tail[14]) << 48; - case 14: - k2 ^= ((DN_U64)tail[13]) << 40; - case 13: - k2 ^= ((DN_U64)tail[12]) << 32; - case 12: - k2 ^= ((DN_U64)tail[11]) << 24; - case 11: - k2 ^= ((DN_U64)tail[10]) << 16; - case 10: - k2 ^= ((DN_U64)tail[9]) << 8; - case 9: - k2 ^= ((DN_U64)tail[8]) << 0; - k2 *= c2; - k2 = DN_MMH3_ROTL64(k2, 33); - k2 *= c1; - h2 ^= k2; + h1 = DN_Murmur3FMix64_(h1); + h2 = DN_Murmur3FMix64_(h2); - case 8: - k1 ^= ((DN_U64)tail[7]) << 56; - case 7: - k1 ^= ((DN_U64)tail[6]) << 48; - case 6: - k1 ^= ((DN_U64)tail[5]) << 40; - case 5: - k1 ^= ((DN_U64)tail[4]) << 32; - case 4: - k1 ^= ((DN_U64)tail[3]) << 24; - case 3: - k1 ^= ((DN_U64)tail[2]) << 16; - case 2: - k1 ^= ((DN_U64)tail[1]) << 8; - case 1: - k1 ^= ((DN_U64)tail[0]) << 0; - k1 *= c1; - k1 = DN_MMH3_ROTL64(k1, 31); - k1 *= c2; - h1 ^= k1; - }; + h1 += h2; + h2 += h1; - //---------- - // finalization - - h1 ^= len; - h2 ^= len; - - h1 += h2; - h2 += h1; - - h1 = DN_Murmur3FMix64_(h1); - h2 = DN_Murmur3FMix64_(h2); - - h1 += h2; - h2 += h1; - - DN_Murmur3 result = {}; - result.e[0] = h1; - result.e[1] = h2; - return result; + DN_Murmur3 result = {}; + result.e[0] = h1; + result.e[1] = h2; + return result; } DN_API DN_U64 DN_Murmur3HashU64FromBytesX64(void const *bytes, int len, DN_U32 seed) { DN_Murmur3 hash = DN_Murmur3HashU128FromBytesX64(bytes, len, seed); - DN_U64 result = hash.e[0]; + DN_U64 result = hash.e[0]; return result; } DN_API DN_U32 DN_Murmur3HashU32FromBytesX64(void const *bytes, int len, DN_U32 seed) { DN_Murmur3 hash = DN_Murmur3HashU128FromBytesX64(bytes, len, seed); - DN_U32 result = DN_Cast(DN_U32)hash.e[0]; + DN_U32 result = DN_Cast(DN_U32)hash.e[0]; return result; } @@ -7390,7 +7394,7 @@ DN_API DN_V4F32 DN_V4F32Linear01FromSrgb01(DN_V4F32 srgb01) DN_API DN_V4F32 DN_V4F32Linear01Desaturate(DN_V4F32 linear01, DN_F32 t01) { - DN_F32 luminance = (linear01.r * DN_V3F32_Rgb_LUMINANCE.r) + (linear01.g * DN_V3F32_Rgb_LUMINANCE.g) + (linear01.b * DN_V3F32_Rgb_LUMINANCE.b); + DN_F32 luminance = (linear01.r * DN_V3F32_RGB_LUMINANCE.r) + (linear01.g * DN_V3F32_RGB_LUMINANCE.g) + (linear01.b * DN_V3F32_RGB_LUMINANCE.b); DN_V4F32 result = linear01; result.rgb = DN_V3F32Lerp(result.rgb, t01, DN_V3F32From1N(luminance)); return result; diff --git a/Source/dn.h b/Source/dn.h index d1eafe3..ccf6a0d 100644 --- a/Source/dn.h +++ b/Source/dn.h @@ -300,6 +300,7 @@ // NOTE: Platform identification #if !defined(DN_PLATFORM_EMSCRIPTEN) && \ !defined(DN_PLATFORM_POSIX) && \ + !defined(DN_PLATFORM_ARM64) && \ !defined(DN_PLATFORM_WIN32) #if defined(__aarch64__) || defined(_M_ARM64) #define DN_PLATFORM_ARM64 @@ -3319,7 +3320,14 @@ DN_API void DN_ProfilerFmtToStdout DN_API DN_F64 DN_ProfilerSecFromTsc (DN_Profiler *profiler, DN_U64 duration_tsc); DN_API DN_F64 DN_ProfilerMsFromTsc (DN_Profiler *profiler, DN_U64 duration_tsc); -DN_API void DN_QSort (void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare); +DN_API void DN_QSort_ (void *array, DN_USize array_size, DN_USize elem_size, void *user_context, DN_QSortCompareFunc *compare); +#if defined(__cplusplus) +template void DN_QSortT (T *array, DN_USize array_size, void *user_context, DN_QSortCompareFunc *compare); +#define DN_QSort(array, array_size, user_context, compare) DN_QSortT(array, array_size, user_context, compare) +#else +#define DN_QSort(array, array_size, user_context, compare) DN_QSort_(array, array_size, sizeof(*array), user_context, compare) +#endif + DN_API bool DN_QSortCompareStr8NaturalAsc (void const* lhs, void const *rhs, void *user_context); DN_API bool DN_QSortCompareStr8NaturalDesc (void const* lhs, void const *rhs, void *user_context); DN_API bool DN_QSortCompareStr8LexicographicAsc (void const* lhs, void const *rhs, void *user_context); @@ -3580,7 +3588,7 @@ DN_API DN_F32 DN_V2F32Area // NOTE: Grayscale co-efficients from: // https://github.com/EpicGames/UnrealEngine/blob/260bb2e1c5610b31c63a36206eedd289409c5f11/Engine/Source/Runtime/Core/Private/Math/Color.cpp#L304 -DN_V3F32 static const DN_V3F32_Rgb_LUMINANCE = DN_V3F32From3N(0.3f, 0.59f, 0.11f); +DN_V3F32 static const DN_V3F32_RGB_LUMINANCE = DN_V3F32From3N(0.3f, 0.59f, 0.11f); DN_API bool operator== (DN_V3F32 lhs, DN_V3F32 rhs); DN_API bool operator!= (DN_V3F32 lhs, DN_V3F32 rhs);