Merge pull request #38777 from madmiraal/update-r128

Update r128.h to include latest fixes for mingw-64 32 bit builds.
This commit is contained in:
Rémi Verschelde 2020-05-16 11:56:40 +02:00 committed by GitHub
commit 988dd09047
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -386,7 +386,7 @@ Collection of single-file libraries used in Godot components.
* License: Apache 2.0 * License: Apache 2.0
- `r128.h` - `r128.h`
* Upstream: https://github.com/fahickman/r128 * Upstream: https://github.com/fahickman/r128
* Version: 1.4.3 (2019) * Version: git (423f693617faafd01de21e92818add4208eb8bd1, 2020)
* License: Public Domain * License: Public Domain
- `smaz.{c,h}` - `smaz.{c,h}`
* Upstream: https://github.com/antirez/smaz * Upstream: https://github.com/antirez/smaz

View file

@ -665,7 +665,7 @@ static int r128__clz64(R128_U64 x)
// 32*32->64 // 32*32->64
static R128_U64 r128__umul64(R128_U32 a, R128_U32 b) static R128_U64 r128__umul64(R128_U32 a, R128_U32 b)
{ {
# if defined(_M_IX86) && !defined(R128_STDC_ONLY) # if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
return __emulu(a, b); return __emulu(a, b);
# elif defined(_M_ARM) && !defined(R128_STDC_ONLY) # elif defined(_M_ARM) && !defined(R128_STDC_ONLY)
return _arm_umull(a, b); return _arm_umull(a, b);
@ -680,7 +680,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) # if defined(_M_IX86) && (_MSC_VER >= 1920) && !defined(R128_STDC_ONLY)
unsigned __int64 n = ((unsigned __int64)nhi << 32) | nlo; unsigned __int64 n = ((unsigned __int64)nhi << 32) | nlo;
return _udiv64(n, d, rem); return _udiv64(n, d, rem);
# elif defined(_M_IX86) && !defined(R128_STDC_ONLY) # elif defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm { __asm {
mov eax, nlo mov eax, nlo
mov edx, nhi mov edx, nhi
@ -795,7 +795,7 @@ static void r128__umul128(R128 *dst, R128_U64 a, R128_U64 b)
} }
// 128/64->64 // 128/64->64
#if defined(_M_X64) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY) #if defined(_M_X64) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
// MSVC x64 provides neither inline assembly nor (pre-2019) a div intrinsic, so we do fake // 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. // "inline assembly" to avoid long division or outline assembly.
#pragma code_seg(".text") #pragma code_seg(".text")
@ -810,7 +810,7 @@ static const r128__udiv128Proc r128__udiv128 = (r128__udiv128Proc)(void*)r128__u
#else #else
static R128_U64 r128__udiv128(R128_U64 nlo, R128_U64 nhi, R128_U64 d, R128_U64 *rem) static R128_U64 r128__udiv128(R128_U64 nlo, R128_U64 nhi, R128_U64 d, R128_U64 *rem)
{ {
#if defined(_M_X64) && !defined(R128_STDC_ONLY) #if defined(_M_X64) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
return _udiv128(nhi, nlo, d, rem); return _udiv128(nhi, nlo, d, rem);
#elif defined(__x86_64__) && !defined(R128_STDC_ONLY) #elif defined(__x86_64__) && !defined(R128_STDC_ONLY)
R128_U64 q, r; R128_U64 q, r;
@ -1602,7 +1602,7 @@ void r128Shl(R128 *dst, const R128 *src, int amount)
R128_ASSERT(dst != NULL); R128_ASSERT(dst != NULL);
R128_ASSERT(src != NULL); R128_ASSERT(src != NULL);
#if defined(_M_IX86) && !defined(R128_STDC_ONLY) #if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm { __asm {
// load src // load src
mov edx, dword ptr[src] mov edx, dword ptr[src]
@ -1664,7 +1664,7 @@ void r128Shr(R128 *dst, const R128 *src, int amount)
R128_ASSERT(dst != NULL); R128_ASSERT(dst != NULL);
R128_ASSERT(src != NULL); R128_ASSERT(src != NULL);
#if defined(_M_IX86) && !defined(R128_STDC_ONLY) #if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm { __asm {
// load src // load src
mov edx, dword ptr[src] mov edx, dword ptr[src]
@ -1726,7 +1726,7 @@ void r128Sar(R128 *dst, const R128 *src, int amount)
R128_ASSERT(dst != NULL); R128_ASSERT(dst != NULL);
R128_ASSERT(src != NULL); R128_ASSERT(src != NULL);
#if defined(_M_IX86) && !defined(R128_STDC_ONLY) #if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__)
__asm { __asm {
// load src // load src
mov edx, dword ptr[src] mov edx, dword ptr[src]