From ff99aec1ab2b4d8a750cb5657d3aa26235bd8c78 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 9 Oct 2017 17:45:44 +0100 Subject: [PATCH] Converted some old uses of non-C++ maths functions to their std equivalents --- .../BlocksSynth/Source/WaveshapeProgram.h | 2 +- examples/NetworkGraphicsDemo/Source/Demos.h | 4 +- .../Surround/Source/SurroundProcessor.cpp | 2 +- .../buffers/juce_FloatVectorOperations.cpp | 4 +- .../mpe/juce_MPEInstrument.cpp | 4 +- .../juce_audio_basics/mpe/juce_MPEValue.cpp | 4 +- .../juce_core/javascript/juce_Javascript.cpp | 173 +++++++++--------- .../containers/juce_SIMDRegister_test.cpp | 4 +- modules/juce_dsp/frequency/juce_Windowing.cpp | 2 +- 9 files changed, 100 insertions(+), 99 deletions(-) diff --git a/examples/BLOCKS/BlocksSynth/Source/WaveshapeProgram.h b/examples/BLOCKS/BlocksSynth/Source/WaveshapeProgram.h index 7c0f6b2cf2..ef31ff21ed 100644 --- a/examples/BLOCKS/BlocksSynth/Source/WaveshapeProgram.h +++ b/examples/BLOCKS/BlocksSynth/Source/WaveshapeProgram.h @@ -56,7 +56,7 @@ public: for (auto x = 0; x < 30; ++x) { // Scale and offset the sin output to the Lightpad display - auto sineOutput = sin (currentPhase); + auto sineOutput = std::sin (currentPhase); sineWaveY[x] = static_cast (roundToInt ((sineOutput * 6.5) + 7.0)); // Square wave output, set flags for when vertical line should be drawn diff --git a/examples/NetworkGraphicsDemo/Source/Demos.h b/examples/NetworkGraphicsDemo/Source/Demos.h index 4b7c2c5647..a50117d171 100644 --- a/examples/NetworkGraphicsDemo/Source/Demos.h +++ b/examples/NetworkGraphicsDemo/Source/Demos.h @@ -299,7 +299,7 @@ struct FlockDemo : public BackgroundLogo { const float regionSize = high - low; const float adjustedProportion = (proportion - low) / regionSize; - const float F = (0.5f - cos (adjustedProportion * float_Pi * 2.0f) * 0.5f + 0.5f) * strength; + const float F = (0.5f - std::cos (adjustedProportion * float_Pi * 2.0f) * 0.5f + 0.5f) * strength; b1.accelerate (getVectorWithLength (b2.velocity, F)); b2.accelerate (getVectorWithLength (b1.velocity, F)); @@ -308,7 +308,7 @@ struct FlockDemo : public BackgroundLogo { const float regionSize = 1.0f - high; const float adjustedProportion = (proportion - high) / regionSize; - const float F = (0.5f - cos (adjustedProportion * float_Pi * 2.0f) * 0.5f + 0.5f) * strength; + const float F = (0.5f - std::cos (adjustedProportion * float_Pi * 2.0f) * 0.5f + 0.5f) * strength; delta = getVectorWithLength (delta, F); b1.accelerate (-delta); diff --git a/examples/PlugInSamples/Surround/Source/SurroundProcessor.cpp b/examples/PlugInSamples/Surround/Source/SurroundProcessor.cpp index 7555cada2e..66c6805566 100644 --- a/examples/PlugInSamples/Surround/Source/SurroundProcessor.cpp +++ b/examples/PlugInSamples/Surround/Source/SurroundProcessor.cpp @@ -72,7 +72,7 @@ public: float sample = buffer.getReadPointer (ch)[j]; alpha = (0.8f * alpha) + (0.2f * sample); - if (fabsf (alpha) >= 0.1f) + if (std::abs (alpha) >= 0.1f) channelTime = static_cast (getSampleRate() / 2.0); } diff --git a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp index 9c3316c3d5..6c8816f623 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp @@ -846,7 +846,7 @@ void FloatVectorOperations::abs (float* dest, const float* src, int num) noexcep #else FloatVectorHelpers::signMask32 signMask; signMask.i = 0x7fffffffUL; - JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabsf (src[i]), Mode::bit_and (s, mask), + JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = std::abs (src[i]), Mode::bit_and (s, mask), JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, const Mode::ParallelType mask = Mode::load1 (signMask.f);) @@ -862,7 +862,7 @@ void FloatVectorOperations::abs (double* dest, const double* src, int num) noexc FloatVectorHelpers::signMask64 signMask; signMask.i = 0x7fffffffffffffffULL; - JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabs (src[i]), Mode::bit_and (s, mask), + JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = std::abs (src[i]), Mode::bit_and (s, mask), JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST, const Mode::ParallelType mask = Mode::load1 (signMask.d);) diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp index 24bfd2e260..3f919d8d44 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp @@ -2140,8 +2140,8 @@ private: void expectDoubleWithinRelativeError (double actual, double expected, double maxRelativeError) { - const double maxAbsoluteError = jmax (1.0, std::fabs (expected)) * maxRelativeError; - expect (std::fabs (expected - actual) < maxAbsoluteError); + const double maxAbsoluteError = jmax (1.0, std::abs (expected)) * maxRelativeError; + expect (std::abs (expected - actual) < maxAbsoluteError); } //============================================================================== diff --git a/modules/juce_audio_basics/mpe/juce_MPEValue.cpp b/modules/juce_audio_basics/mpe/juce_MPEValue.cpp index d9fbd7db39..2b82929d9b 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEValue.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEValue.cpp @@ -161,8 +161,8 @@ private: //============================================================================== void expectFloatWithinRelativeError (float actualValue, float expectedValue, float maxRelativeError) { - const float maxAbsoluteError = jmax (1.0f, std::fabs (expectedValue)) * maxRelativeError; - expect (std::fabs (expectedValue - actualValue) < maxAbsoluteError); + const float maxAbsoluteError = jmax (1.0f, std::abs (expectedValue)) * maxRelativeError; + expect (std::abs (expectedValue - actualValue) < maxAbsoluteError); } }; diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index 9ef8305160..90ed278bed 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -115,7 +115,7 @@ struct JavascriptEngine::RootObject : public DynamicObject { int col = 1, line = 1; - for (String::CharPointerType i (program.getCharPointer()); i < location && ! i.isEmpty(); ++i) + for (auto i = program.getCharPointer(); i < location && ! i.isEmpty(); ++i) { ++col; if (*i == '\n') { col = 1; ++line; } @@ -271,8 +271,8 @@ struct JavascriptEngine::RootObject : public DynamicObject ResultCode perform (const Scope& s, var* returnedValue) const override { - for (int i = 0; i < statements.size(); ++i) - if (ResultCode r = statements.getUnchecked(i)->perform (s, returnedValue)) + for (auto* statement : statements) + if (auto r = statement->perform (s, returnedValue)) return r; return ok; @@ -319,7 +319,7 @@ struct JavascriptEngine::RootObject : public DynamicObject while (isDoLoop || condition->getResult (s)) { s.checkTimeOut (location); - ResultCode r = body->perform (s, returnedValue); + auto r = body->perform (s, returnedValue); if (r == returnWasHit) return r; if (r == breakWasHit) break; @@ -378,7 +378,7 @@ struct JavascriptEngine::RootObject : public DynamicObject void assign (const Scope& s, const var& newValue) const override { - if (var* v = getPropertyPointer (s.scope, name)) + if (auto* v = getPropertyPointer (s.scope, name)) *v = newValue; else s.root->setProperty (name, newValue); @@ -393,17 +393,17 @@ struct JavascriptEngine::RootObject : public DynamicObject var getResult (const Scope& s) const override { - var p (parent->getResult (s)); + auto p = parent->getResult (s); static const Identifier lengthID ("length"); if (child == lengthID) { - if (Array* array = p.getArray()) return array->size(); - if (p.isString()) return p.toString().length(); + if (auto* array = p.getArray()) return array->size(); + if (p.isString()) return p.toString().length(); } - if (DynamicObject* o = p.getDynamicObject()) - if (const var* v = getPropertyPointer (o, child)) + if (auto* o = p.getDynamicObject()) + if (auto* v = getPropertyPointer (o, child)) return *v; return var::undefined(); @@ -411,7 +411,7 @@ struct JavascriptEngine::RootObject : public DynamicObject void assign (const Scope& s, const var& newValue) const override { - if (DynamicObject* o = parent->getResult (s).getDynamicObject()) + if (auto* o = parent->getResult (s).getDynamicObject()) o->setProperty (child, newValue); else Expression::assign (s, newValue); @@ -427,16 +427,16 @@ struct JavascriptEngine::RootObject : public DynamicObject var getResult (const Scope& s) const override { - var arrayVar (object->getResult (s)); // must stay alive for the scope of this method - var key = index->getResult (s); + auto arrayVar = object->getResult (s); // must stay alive for the scope of this method + auto key = index->getResult (s); - if (const Array* array = arrayVar.getArray()) + if (const auto* array = arrayVar.getArray()) if (key.isInt() || key.isInt64() || key.isDouble()) return (*array) [static_cast (key)]; - if (DynamicObject* o = arrayVar.getDynamicObject()) + if (auto* o = arrayVar.getDynamicObject()) if (key.isString()) - if (const var* v = getPropertyPointer (o, Identifier (key))) + if (auto* v = getPropertyPointer (o, Identifier (key))) return *v; return var::undefined(); @@ -444,10 +444,10 @@ struct JavascriptEngine::RootObject : public DynamicObject void assign (const Scope& s, const var& newValue) const override { - var arrayVar (object->getResult (s)); // must stay alive for the scope of this method - var key = index->getResult (s); + auto arrayVar = object->getResult (s); // must stay alive for the scope of this method + auto key = index->getResult (s); - if (Array* array = arrayVar.getArray()) + if (auto* array = arrayVar.getArray()) { if (key.isInt() || key.isInt64() || key.isDouble()) { @@ -460,7 +460,7 @@ struct JavascriptEngine::RootObject : public DynamicObject } } - if (DynamicObject* o = arrayVar.getDynamicObject()) + if (auto* o = arrayVar.getDynamicObject()) { if (key.isString()) { @@ -678,7 +678,7 @@ struct JavascriptEngine::RootObject : public DynamicObject var getResult (const Scope& s) const override { - var value (newValue->getResult (s)); + auto value = newValue->getResult (s); target->assign (s, value); return value; } @@ -693,7 +693,7 @@ struct JavascriptEngine::RootObject : public DynamicObject var getResult (const Scope& s) const override { - var value (newValue->getResult (s)); + auto value = newValue->getResult (s); target->assign (s, value); return value; } @@ -709,7 +709,7 @@ struct JavascriptEngine::RootObject : public DynamicObject var getResult (const Scope& s) const override { - var oldValue (target->getResult (s)); + auto oldValue = target->getResult (s); target->assign (s, newValue->getResult (s)); return oldValue; } @@ -721,34 +721,34 @@ struct JavascriptEngine::RootObject : public DynamicObject var getResult (const Scope& s) const override { - if (DotOperator* dot = dynamic_cast (object.get())) + if (auto* dot = dynamic_cast (object.get())) { - var thisObject (dot->parent->getResult (s)); + auto thisObject = dot->parent->getResult (s); return invokeFunction (s, s.findFunctionCall (location, thisObject, dot->child), thisObject); } - var function (object->getResult (s)); + auto function = object->getResult (s); return invokeFunction (s, function, var (s.scope.get())); } var invokeFunction (const Scope& s, const var& function, const var& thisObject) const { s.checkTimeOut (location); - Array argVars; - for (int i = 0; i < arguments.size(); ++i) - argVars.add (arguments.getUnchecked(i)->getResult (s)); + + for (auto* a : arguments) + argVars.add (a->getResult (s)); const var::NativeFunctionArgs args (thisObject, argVars.begin(), argVars.size()); if (var::NativeFunction nativeFunction = function.getNativeFunction()) return nativeFunction (args); - if (FunctionObject* fo = dynamic_cast (function.getObject())) + if (auto* fo = dynamic_cast (function.getObject())) return fo->invoke (s, args); - if (DotOperator* dot = dynamic_cast (object.get())) - if (DynamicObject* o = thisObject.getDynamicObject()) + if (auto* dot = dynamic_cast (object.get())) + if (auto* o = thisObject.getDynamicObject()) if (o->hasMethod (dot->child)) // allow an overridden DynamicObject::invokeMethod to accept a method call. return o->invokeMethod (dot->child, args); @@ -766,8 +766,8 @@ struct JavascriptEngine::RootObject : public DynamicObject var getResult (const Scope& s) const override { var classOrFunc = object->getResult (s); - const bool isFunc = isFunction (classOrFunc); + if (! (isFunc || classOrFunc.getDynamicObject() != nullptr)) return var::undefined(); @@ -894,10 +894,10 @@ struct JavascriptEngine::RootObject : public DynamicObject { if (isIdentifierStart (*p)) { - String::CharPointerType end (p); + auto end = p; while (isIdentifierBody (*++end)) {} - const size_t len = (size_t) (end - p); + auto len = (size_t) (end - p); #define JUCE_JS_COMPARE_KEYWORD(name, str) if (len == sizeof (str) - 1 && matchToken (TokenTypes::name, len)) return TokenTypes::name; JUCE_JS_KEYWORDS (JUCE_JS_COMPARE_KEYWORD) @@ -939,7 +939,7 @@ struct JavascriptEngine::RootObject : public DynamicObject if (*p == '/') { - const juce_wchar c2 = p[1]; + auto c2 = p[1]; if (c2 == '/') { p = CharacterFunctions::find (p, (juce_wchar) '\n'); continue; } @@ -961,7 +961,7 @@ struct JavascriptEngine::RootObject : public DynamicObject if (quoteType != '"' && quoteType != '\'') return false; - Result r (JSON::parseQuotedString (p, currentValue)); + auto r = JSON::parseQuotedString (p, currentValue); if (r.failed()) location.throwError (r.getErrorMessage()); return true; } @@ -970,13 +970,13 @@ struct JavascriptEngine::RootObject : public DynamicObject { if (*p != '0' || (p[1] != 'x' && p[1] != 'X')) return false; - String::CharPointerType t (++p); + auto t = ++p; int64 v = CharacterFunctions::getHexDigitValue (*++t); if (v < 0) return false; for (;;) { - const int digit = CharacterFunctions::getHexDigitValue (*++t); + auto digit = CharacterFunctions::getHexDigitValue (*++t); if (digit < 0) break; v = v * 16 + digit; } @@ -988,7 +988,7 @@ struct JavascriptEngine::RootObject : public DynamicObject bool parseFloatLiteral() { int numDigits = 0; - String::CharPointerType t (p); + auto t = p; while (t.isDigit()) { ++t; ++numDigits; } const bool hasPoint = (*t == '.'); @@ -999,7 +999,7 @@ struct JavascriptEngine::RootObject : public DynamicObject if (numDigits == 0) return false; - juce_wchar c = *t; + auto c = *t; const bool hasExponent = (c == 'e' || c == 'E'); if (hasExponent) @@ -1018,13 +1018,13 @@ struct JavascriptEngine::RootObject : public DynamicObject bool parseOctalLiteral() { - String::CharPointerType t (p); + auto t = p; int64 v = *t - '0'; if (v != 0) return false; // first digit of octal must be 0 for (;;) { - const int digit = (int) (*++t - '0'); + auto digit = (int) (*++t - '0'); if (isPositiveAndBelow (digit, 8)) v = v * 8 + digit; else if (isPositiveAndBelow (digit, 10)) location.throwError ("Decimal digit in octal constant"); else break; @@ -1040,7 +1040,7 @@ struct JavascriptEngine::RootObject : public DynamicObject for (;; ++p) { - const int digit = (int) (*p - '0'); + auto digit = (int) (*p - '0'); if (isPositiveAndBelow (digit, 10)) v = v * 10 + digit; else break; } @@ -1160,7 +1160,7 @@ struct JavascriptEngine::RootObject : public DynamicObject if (matchIf (TokenTypes::semicolon)) return new ReturnStatement (location, new Expression (location)); - ReturnStatement* r = new ReturnStatement (location, parseExpression()); + auto* r = new ReturnStatement (location, parseExpression()); matchIf (TokenTypes::semicolon); return r; } @@ -1186,7 +1186,7 @@ struct JavascriptEngine::RootObject : public DynamicObject Statement* parseFunction() { Identifier name; - var fn = parseFunctionDefinition (name); + auto fn = parseFunctionDefinition (name); if (name.isNull()) throwError ("Functions defined at statement-level must have a name"); @@ -1255,7 +1255,7 @@ struct JavascriptEngine::RootObject : public DynamicObject var parseFunctionDefinition (Identifier& functionName) { - const String::CharPointerType functionStart (location.location); + auto functionStart = location.location; if (currentType == TokenTypes::identifier) functionName = parseIdentifier(); @@ -1552,7 +1552,7 @@ struct JavascriptEngine::RootObject : public DynamicObject static var contains (Args a) { - if (const Array* array = a.thisObject.getArray()) + if (auto* array = a.thisObject.getArray()) return array->contains (get (a, 0)); return false; @@ -1560,7 +1560,7 @@ struct JavascriptEngine::RootObject : public DynamicObject static var remove (Args a) { - if (Array* array = a.thisObject.getArray()) + if (auto* array = a.thisObject.getArray()) array->removeAllInstancesOf (get (a, 0)); return var::undefined(); @@ -1570,16 +1570,16 @@ struct JavascriptEngine::RootObject : public DynamicObject { StringArray strings; - if (const Array* array = a.thisObject.getArray()) - for (int i = 0; i < array->size(); ++i) - strings.add (array->getReference(i).toString()); + if (auto* array = a.thisObject.getArray()) + for (auto& v : *array) + strings.add (v.toString()); return strings.joinIntoString (getString (a, 0)); } static var push (Args a) { - if (Array* array = a.thisObject.getArray()) + if (auto* array = a.thisObject.getArray()) { for (int i = 0; i < a.numArguments; ++i) array->add (a.arguments[i]); @@ -1592,9 +1592,9 @@ struct JavascriptEngine::RootObject : public DynamicObject static var splice (Args a) { - if (Array* array = a.thisObject.getArray()) + if (auto* array = a.thisObject.getArray()) { - const int arraySize = array->size(); + auto arraySize = array->size(); int start = get (a, 0); if (start < 0) @@ -1624,9 +1624,9 @@ struct JavascriptEngine::RootObject : public DynamicObject static var indexOf (Args a) { - if (const Array* array = a.thisObject.getArray()) + if (auto* array = a.thisObject.getArray()) { - const var target (get (a, 0)); + auto target = get (a, 0); for (int i = (a.numArguments > 1 ? getInt (a, 1) : 0); i < array->size(); ++i) if (array->getReference(i) == target) @@ -1660,19 +1660,20 @@ struct JavascriptEngine::RootObject : public DynamicObject static var split (Args a) { - const String str (a.thisObject.toString()); - const String sep (getString (a, 0)); + auto str = a.thisObject.toString(); + auto sep = getString (a, 0); StringArray strings; if (sep.isNotEmpty()) - strings.addTokens (str, sep.substring (0, 1), ""); + strings.addTokens (str, sep.substring (0, 1), {}); else // special-case for empty separator: split all chars separately - for (String::CharPointerType pos = str.getCharPointer(); ! pos.isEmpty(); ++pos) + for (auto pos = str.getCharPointer(); ! pos.isEmpty(); ++pos) strings.add (String::charToString (*pos)); var array; - for (int i = 0; i < strings.size(); ++i) - array.append (strings[i]); + + for (auto& s : strings) + array.append (s); return array; } @@ -1713,23 +1714,23 @@ struct JavascriptEngine::RootObject : public DynamicObject static var Math_max (Args a) { return (isInt (a, 0) && isInt (a, 1)) ? var (jmax (getInt (a, 0), getInt (a, 1))) : var (jmax (getDouble (a, 0), getDouble (a, 1))); } static var Math_toDegrees (Args a) { return radiansToDegrees (getDouble (a, 0)); } static var Math_toRadians (Args a) { return degreesToRadians (getDouble (a, 0)); } - static var Math_sin (Args a) { return sin (getDouble (a, 0)); } - static var Math_asin (Args a) { return asin (getDouble (a, 0)); } - static var Math_cos (Args a) { return cos (getDouble (a, 0)); } - static var Math_acos (Args a) { return acos (getDouble (a, 0)); } - static var Math_sinh (Args a) { return sinh (getDouble (a, 0)); } - static var Math_asinh (Args a) { return asinh (getDouble (a, 0)); } - static var Math_cosh (Args a) { return cosh (getDouble (a, 0)); } - static var Math_acosh (Args a) { return acosh (getDouble (a, 0)); } - static var Math_tan (Args a) { return tan (getDouble (a, 0)); } - static var Math_tanh (Args a) { return tanh (getDouble (a, 0)); } - static var Math_atan (Args a) { return atan (getDouble (a, 0)); } - static var Math_atanh (Args a) { return atanh (getDouble (a, 0)); } - static var Math_log (Args a) { return log (getDouble (a, 0)); } - static var Math_log10 (Args a) { return log10 (getDouble (a, 0)); } - static var Math_exp (Args a) { return exp (getDouble (a, 0)); } - static var Math_pow (Args a) { return pow (getDouble (a, 0), getDouble (a, 1)); } - static var Math_sqr (Args a) { double x = getDouble (a, 0); return x * x; } + static var Math_sin (Args a) { return std::sin (getDouble (a, 0)); } + static var Math_asin (Args a) { return std::asin (getDouble (a, 0)); } + static var Math_cos (Args a) { return std::cos (getDouble (a, 0)); } + static var Math_acos (Args a) { return std::acos (getDouble (a, 0)); } + static var Math_sinh (Args a) { return std::sinh (getDouble (a, 0)); } + static var Math_asinh (Args a) { return std::asinh (getDouble (a, 0)); } + static var Math_cosh (Args a) { return std::cosh (getDouble (a, 0)); } + static var Math_acosh (Args a) { return std::acosh (getDouble (a, 0)); } + static var Math_tan (Args a) { return std::tan (getDouble (a, 0)); } + static var Math_tanh (Args a) { return std::tanh (getDouble (a, 0)); } + static var Math_atan (Args a) { return std::atan (getDouble (a, 0)); } + static var Math_atanh (Args a) { return std::atanh (getDouble (a, 0)); } + static var Math_log (Args a) { return std::log (getDouble (a, 0)); } + static var Math_log10 (Args a) { return std::log10 (getDouble (a, 0)); } + static var Math_exp (Args a) { return std::exp (getDouble (a, 0)); } + static var Math_pow (Args a) { return std::pow (getDouble (a, 0), getDouble (a, 1)); } + static var Math_sqr (Args a) { return square (getDouble (a, 0)); } static var Math_sqrt (Args a) { return std::sqrt (getDouble (a, 0)); } static var Math_ceil (Args a) { return std::ceil (getDouble (a, 0)); } static var Math_floor (Args a) { return std::floor (getDouble (a, 0)); } @@ -1754,7 +1755,7 @@ struct JavascriptEngine::RootObject : public DynamicObject static var parseInt (Args a) { - const String s (getString (a, 0).trim()); + auto s = getString (a, 0).trim(); return s[0] == '0' ? (s[1] == 'x' ? s.substring(2).getHexValue64() : getOctalValue (s)) : s.getLargeIntValue(); @@ -1762,9 +1763,9 @@ struct JavascriptEngine::RootObject : public DynamicObject }; //============================================================================== - static var trace (Args a) { Logger::outputDebugString (JSON::toString (a.thisObject)); return var::undefined(); } - static var charToInt (Args a) { return (int) (getString (a, 0)[0]); } - static var parseFloat (Args a) { return getDouble (a, 0); } + static var trace (Args a) { Logger::outputDebugString (JSON::toString (a.thisObject)); return var::undefined(); } + static var charToInt (Args a) { return (int) (getString (a, 0)[0]); } + static var parseFloat (Args a) { return getDouble (a, 0); } static var typeof_internal (Args a) { @@ -1781,7 +1782,7 @@ struct JavascriptEngine::RootObject : public DynamicObject static var exec (Args a) { - if (RootObject* root = dynamic_cast (a.thisObject.getObject())) + if (auto* root = dynamic_cast (a.thisObject.getObject())) root->execute (getString (a, 0)); return var::undefined(); @@ -1789,7 +1790,7 @@ struct JavascriptEngine::RootObject : public DynamicObject static var eval (Args a) { - if (RootObject* root = dynamic_cast (a.thisObject.getObject())) + if (auto* root = dynamic_cast (a.thisObject.getObject())) return root->evaluate (getString (a, 0)); return var::undefined(); diff --git a/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp b/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp index 49bd48eaee..849869d5f6 100644 --- a/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp +++ b/modules/juce_dsp/containers/juce_SIMDRegister_test.cpp @@ -67,13 +67,13 @@ namespace SIMDRegister_test_internal template static type safeAbs (type a) { - return static_cast (fabs ((double) a)); + return static_cast (std::abs (static_cast (a))); } template static type safeAbs (std::complex a) { - return abs (a); + return std::abs (a); } template diff --git a/modules/juce_dsp/frequency/juce_Windowing.cpp b/modules/juce_dsp/frequency/juce_Windowing.cpp index 0c563d54a4..37cbc8dba0 100644 --- a/modules/juce_dsp/frequency/juce_Windowing.cpp +++ b/modules/juce_dsp/frequency/juce_Windowing.cpp @@ -69,7 +69,7 @@ void WindowingFunction::fillWindowingTables (FloatType* samples, size auto halfSlots = static_cast (0.5) * static_cast (size - 1); for (size_t i = 0; i < size; ++i) - samples[i] = static_cast (1.0) - std::fabs ((static_cast (i) - halfSlots) / halfSlots); + samples[i] = static_cast (1.0) - std::abs ((static_cast (i) - halfSlots) / halfSlots); } break;