xbrz: fix inline asm check
Use correct cpp code to detect x86/amd64 architecture to use inline asm. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
e811070d01
commit
af0de1c4b3
|
@ -66,17 +66,17 @@ uint32_t gradientARGB(uint32_t pixFront, uint32_t pixBack) //find intermediate c
|
||||||
|
|
||||||
inline double fastSqrt(double n)
|
inline double fastSqrt(double n)
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__ || __clang__ || __MINGW64_VERSION_MAJOR || __MINGW32_MAJOR_VERSION
|
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
|
||||||
__asm__ ("fsqrt" : "+t" (n));
|
__asm__ ("fsqrt" : "+t" (n));
|
||||||
return n;
|
return n;
|
||||||
#elif _MSC_VER && _M_IX86
|
#elif defined(_MSC_VER) && defined(_M_IX86)
|
||||||
// speeds up xBRZ by about 9% compared to std::sqrt which internally uses
|
// speeds up xBRZ by about 9% compared to std::sqrt which internally uses
|
||||||
// the same assembler instructions but adds some "fluff"
|
// the same assembler instructions but adds some "fluff"
|
||||||
__asm {
|
__asm {
|
||||||
fld n
|
fld n
|
||||||
fsqrt
|
fsqrt
|
||||||
}
|
}
|
||||||
#else // _MSC_VER && _M_X64 OR other platforms
|
#else // defined(_MSC_VER) && defined(_M_X64) OR other platforms
|
||||||
// VisualStudio x86_64 does not allow inline ASM
|
// VisualStudio x86_64 does not allow inline ASM
|
||||||
return std::sqrt(n);
|
return std::sqrt(n);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue