Browse Source

Avoid warnings in Intel compiler.

tags/2021-05-28
jules 12 years ago
parent
commit
b3c0df703f
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      modules/juce_core/maths/juce_MathsFunctions.h

+ 14
- 2
modules/juce_core/maths/juce_MathsFunctions.h View File

@@ -331,7 +331,9 @@ inline bool juce_isfinite (FloatingPointType value)
//============================================================================== //==============================================================================
#if JUCE_MSVC #if JUCE_MSVC
#pragma optimize ("t", off) #pragma optimize ("t", off)
#pragma float_control (precise, on, push)
#ifndef __INTEL_COMPILER
#pragma float_control (precise, on, push)
#endif
#endif #endif
/** Fast floating-point-to-integer conversion. /** Fast floating-point-to-integer conversion.
@@ -347,6 +349,10 @@ inline bool juce_isfinite (FloatingPointType value)
template <typename FloatType> template <typename FloatType>
inline int roundToInt (const FloatType value) noexcept inline int roundToInt (const FloatType value) noexcept
{ {
#ifdef __INTEL_COMPILER
#pragma float_control (precise, on, push)
#endif
union { int asInt[2]; double asDouble; } n; union { int asInt[2]; double asDouble; } n;
n.asDouble = ((double) value) + 6755399441055744.0; n.asDouble = ((double) value) + 6755399441055744.0;
@@ -355,10 +361,16 @@ inline int roundToInt (const FloatType value) noexcept
#else #else
return n.asInt [0]; return n.asInt [0];
#endif #endif
#ifdef __INTEL_COMPILER
#pragma float_control (pop)
#endif
} }
#if JUCE_MSVC #if JUCE_MSVC
#pragma float_control (pop)
#ifndef __INTEL_COMPILER
#pragma float_control (pop)
#endif
#pragma optimize ("", on) // resets optimisations to the project defaults #pragma optimize ("", on) // resets optimisations to the project defaults
#endif #endif


Loading…
Cancel
Save