Godot Engine – Multi-platform 2D and 3D game engine
r128: Update to 1.6.2
Jakub Marcowski03741896869f
diff --git a/thirdparty/README.md b/thirdparty/README.mdindex 4f9e4600a25..d518d83cc72 100644--- a/thirdparty/README.md+++ b/thirdparty/README.md@@ -853,9 +853,9 @@ Collection of single-file libraries used in Godot components.* Version: git (1bf9bc04673df55dc554021b768006836f69d53a, 2026)* License: MIT* Modifications: Added implementation through `qoa.c`.-- `r128.{c,h}`+- `r128.h`* Upstream: https://github.com/fahickman/r128- * Version: git (6fc177671c47640d5bb69af10cf4ee91050015a1, 2023)+ * Version: 1.6.2 (69ba68f1ea666c9136cf56e0105b0cbbe9cd1534, 2026)* License: Public Domain or Unlicense- `smaz.{c,h}`* Upstream: https://github.com/antirez/smazdiff --git a/thirdparty/misc/r128.h b/thirdparty/misc/r128.hindex ff05569ea78..3ef4bc62af1 100644--- a/thirdparty/misc/r128.h+++ b/thirdparty/misc/r128.h@@ -1,5 +1,5 @@/*-r128.h: 128-bit (64.64) signed fixed-point arithmetic. Version 1.6.0+r128.h: 128-bit (64.64) signed fixed-point arithmetic. Version 1.6.2COMPILATION-----------@@ -302,8 +302,10 @@ struct numeric_limits<R128>static const bool has_infinity = false;static const bool has_quiet_NaN = false;static const bool has_signaling_NaN = false;+#if !(__cplusplus > 202002L || (defined(_MSVC_LANG) && _MSVC_LANG > 202002L))static const float_denorm_style has_denorm = denorm_absent;static const bool has_denorm_loss = false;+#endifstatic R128 infinity() throw() { return R128_zero; }static R128 quiet_NaN() throw() { return R128_zero; }@@ -668,9 +670,9 @@ static int r128__clz64(R128_U64 x)// 32*32->64static R128_U64 r128__umul64(R128_U32 a, R128_U32 b){-# if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)+# if defined(_M_IX86) && defined(_MSC_VER) && !defined(R128_STDC_ONLY)return __emulu(a, b);-# elif defined(_M_ARM) && !defined(R128_STDC_ONLY)+# elif defined(_M_ARM) && defined(_MSC_VER) && !defined(R128_STDC_ONLY)return _arm_umull(a, b);# elsereturn a * (R128_U64)b;@@ -683,7 +685,7 @@ static R128_U32 r128__udiv64(R128_U32 nlo, R128_U32 nhi, R128_U32 d, R128_U32 *r# if defined(_M_IX86) && (_MSC_VER >= 1920) && !defined(R128_STDC_ONLY)unsigned __int64 n = ((unsigned __int64)nhi << 32) | nlo;return _udiv64(n, d, rem);-# elif defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)+# elif defined(_M_IX86) && defined(_MSC_VER) && !defined(R128_STDC_ONLY)__asm {mov eax, nlomov edx, nhi@@ -750,10 +752,8 @@ static void r128__umul128(R128 *dst, R128_U64 a, R128_U64 b){#if defined(_M_X64) && !defined(R128_STDC_ONLY)dst->lo = _umul128(a, b, &dst->hi);-#elif R128_64BIT && !defined(_MSC_VER) && !defined(R128_STDC_ONLY)- unsigned __int128 p0 = a * (unsigned __int128)b;- dst->hi = (R128_U64)(p0 >> 64);- dst->lo = (R128_U64)p0;+#elif defined(__x86_64__) && !defined(R128_STDC_ONLY)+ __asm__("mulq %3" : "=a"(dst->lo), "=d"(dst->hi) : "a"(a), "rm"(b));#elseR128_U32 alo = (R128_U32)a;R128_U32 ahi = (R128_U32)(a >> 32);@@ -798,7 +798,7 @@ static void r128__umul128(R128 *dst, R128_U64 a, R128_U64 b)}// 128/64->64-#if defined(_M_X64) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)+#if defined(_M_X64) && defined(_MSC_VER) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY)// MSVC x64 provides neither inline assembly nor (pre-2019) a div intrinsic, so we do fake// "inline assembly" to avoid long division or outline assembly.#pragma code_seg(".text")@@ -813,13 +813,11 @@ static const r128__udiv128Proc r128__udiv128 = (r128__udiv128Proc)(void*)r128__u#elsestatic R128_U64 r128__udiv128(R128_U64 nlo, R128_U64 nhi, R128_U64 d, R128_U64 *rem){-#if defined(_M_X64) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)+#if defined(_M_X64) && defined(_MSC_VER) && !defined(R128_STDC_ONLY) && !defined(__clang__)return _udiv128(nhi, nlo, d, rem);#elif defined(__x86_64__) && !defined(R128_STDC_ONLY)R128_U64 q, r;- __asm("divq %4"- : "=a"(q), "=d"(r)- : "a"(nlo), "d"(nhi), "X"(d));+ __asm("divq %4" : "=a"(q), "=d"(r) : "a"(nlo), "d"(nhi), "X"(d));*rem = r;return q;#else@@ -924,38 +922,6 @@ static int r128__ucmp(const R128 *a, const R128 *b)static void r128__umul(R128 *dst, const R128 *a, const R128 *b){-#if defined(_M_X64) && !defined(R128_STDC_ONLY)- R128_U64 t0, t1;- R128_U64 lo, hi = 0;- unsigned char carry;-- t0 = _umul128(a->lo, b->lo, &t1);- carry = _addcarry_u64(0, t1, t0 >> 63, &lo);- _addcarry_u64(carry, hi, hi, &hi);-- t0 = _umul128(a->lo, b->hi, &t1);- carry = _addcarry_u64(0, lo, t0, &lo);- _addcarry_u64(carry, hi, t1, &hi);-- t0 = _umul128(a->hi, b->lo, &t1);- carry = _addcarry_u64(0, lo, t0, &lo);- _addcarry_u64(carry, hi, t1, &hi);-- t0 = _umul128(a->hi, b->hi, &t1);- hi += t0;-- R128_SET2(dst, lo, hi);-#elif defined(__x86_64__) && !defined(R128_STDC_ONLY)- unsigned __int128 p0, p1, p2, p3;- p0 = a->lo * (unsigned __int128)b->lo;- p1 = a->lo * (unsigned __int128)b->hi;- p2 = a->hi * (unsigned __int128)b->lo;- p3 = a->hi * (unsigned __int128)b->hi;-- p0 = (p3 << 64) + p2 + p1 + (p0 >> 64) + ((R128_U64)p0 >> 63);- dst->lo = (R128_U64)p0;- dst->hi = (R128_U64)(p0 >> 64);-#elseR128 p0, p1, p2, p3, round;r128__umul128(&p0, a->lo, b->lo);@@ -974,7 +940,6 @@ static void r128__umul(R128 *dst, const R128 *a, const R128 *b)r128Add(&p0, &p0, &p3);R128_SET2(dst, p0.lo, p0.hi);-#endif}// Shift d left until the high bit is set, and shift n left by the same amount.@@ -1191,8 +1156,8 @@ static int r128__format(char *dst, size_t dstSize, const R128 *v, const R128ToSt// print a maximum of 20 digitsfullPrecision = 0;precision = 20;- } else if (precision > sizeof(buf) - 21) {- trail = precision - (sizeof(buf) - 21);+ } else if (precision > (int)(sizeof(buf) - 21)) {+ trail = precision - (int)(sizeof(buf) - 21);precision -= trail;}@@ -1637,7 +1602,7 @@ void r128Shl(R128 *dst, const R128 *src, int amount)R128_ASSERT(dst != NULL);R128_ASSERT(src != NULL);-#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)+#if defined(_M_IX86) && defined(_MSC_VER) && !defined(R128_STDC_ONLY)__asm {// load srcmov edx, dword ptr[src]@@ -1699,7 +1664,7 @@ void r128Shr(R128 *dst, const R128 *src, int amount)R128_ASSERT(dst != NULL);R128_ASSERT(src != NULL);-#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)+#if defined(_M_IX86) && defined(_MSC_VER) && !defined(R128_STDC_ONLY)__asm {// load srcmov edx, dword ptr[src]@@ -1761,7 +1726,7 @@ void r128Sar(R128 *dst, const R128 *src, int amount)R128_ASSERT(dst != NULL);R128_ASSERT(src != NULL);-#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)+#if defined(_M_IX86) && defined(_MSC_VER) && !defined(R128_STDC_ONLY)__asm {// load srcmov edx, dword ptr[src]