|
Mystro256 |
270fea1 |
From af0de1c4b308ef8d9a081ecf407805b75a99d877 Mon Sep 17 00:00:00 2001
|
|
Mystro256 |
270fea1 |
From: Rafael Kitover <rkitover@gmail.com>
|
|
Mystro256 |
270fea1 |
Date: Fri, 4 Oct 2019 07:35:49 +0000
|
|
Mystro256 |
270fea1 |
Subject: [PATCH] xbrz: fix inline asm check
|
|
Mystro256 |
270fea1 |
|
|
Mystro256 |
270fea1 |
Use correct cpp code to detect x86/amd64 architecture to use inline asm.
|
|
Mystro256 |
270fea1 |
|
|
Mystro256 |
270fea1 |
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
|
|
Mystro256 |
270fea1 |
---
|
|
Mystro256 |
270fea1 |
src/filters/xBRZ/xbrz.cpp | 6 +++---
|
|
Mystro256 |
270fea1 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
Mystro256 |
270fea1 |
|
|
Mystro256 |
270fea1 |
diff --git a/src/filters/xBRZ/xbrz.cpp b/src/filters/xBRZ/xbrz.cpp
|
|
Mystro256 |
270fea1 |
index 36d70be2..13e6cdc1 100644
|
|
Mystro256 |
270fea1 |
--- a/src/filters/xBRZ/xbrz.cpp
|
|
Mystro256 |
270fea1 |
+++ b/src/filters/xBRZ/xbrz.cpp
|
|
Mystro256 |
270fea1 |
@@ -66,17 +66,17 @@ uint32_t gradientARGB(uint32_t pixFront, uint32_t pixBack) //find intermediate c
|
|
Mystro256 |
270fea1 |
|
|
Mystro256 |
270fea1 |
inline double fastSqrt(double n)
|
|
Mystro256 |
270fea1 |
{
|
|
Mystro256 |
270fea1 |
-#ifdef __GNUC__ || __clang__ || __MINGW64_VERSION_MAJOR || __MINGW32_MAJOR_VERSION
|
|
Mystro256 |
270fea1 |
+#if (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
|
|
Mystro256 |
270fea1 |
__asm__ ("fsqrt" : "+t" (n));
|
|
Mystro256 |
270fea1 |
return n;
|
|
Mystro256 |
270fea1 |
-#elif _MSC_VER && _M_IX86
|
|
Mystro256 |
270fea1 |
+#elif defined(_MSC_VER) && defined(_M_IX86)
|
|
Mystro256 |
270fea1 |
// speeds up xBRZ by about 9% compared to std::sqrt which internally uses
|
|
Mystro256 |
270fea1 |
// the same assembler instructions but adds some "fluff"
|
|
Mystro256 |
270fea1 |
__asm {
|
|
Mystro256 |
270fea1 |
fld n
|
|
Mystro256 |
270fea1 |
fsqrt
|
|
Mystro256 |
270fea1 |
}
|
|
Mystro256 |
270fea1 |
-#else // _MSC_VER && _M_X64 OR other platforms
|
|
Mystro256 |
270fea1 |
+#else // defined(_MSC_VER) && defined(_M_X64) OR other platforms
|
|
Mystro256 |
270fea1 |
// VisualStudio x86_64 does not allow inline ASM
|
|
Mystro256 |
270fea1 |
return std::sqrt(n);
|
|
Mystro256 |
270fea1 |
#endif
|
|
Mystro256 |
270fea1 |
--
|
|
Mystro256 |
270fea1 |
2.21.1
|
|
Mystro256 |
270fea1 |
|