Browse Source

Fix potential wrong-over-optimization in math utilities

Signed-off-by: falkTX <falktx@falktx.com>
pull/1849/head
falkTX 10 months ago
parent
commit
73ddea269b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 8 additions and 8 deletions
  1. +3
    -3
      source/utils/CarlaMathUtils.hpp
  2. +5
    -5
      source/utils/CarlaUtils.hpp

+ 3
- 3
source/utils/CarlaMathUtils.hpp View File

@@ -179,7 +179,7 @@ void carla_addFloats(float dest[], const float src[], const std::size_t count) n
if (!std::isfinite(src[i])) if (!std::isfinite(src[i]))
__builtin_unreachable(); __builtin_unreachable();
#endif #endif
*dest++ += *src++;
dest[i] += src[i];
} }
} }


@@ -217,7 +217,7 @@ void carla_fillFloatsWithSingleValue(float data[], const float& value, const std
if (!std::isfinite(data[i])) if (!std::isfinite(data[i]))
__builtin_unreachable(); __builtin_unreachable();
#endif #endif
*data++ = value;
data[i] = value;
} }
} }
} }
@@ -302,7 +302,7 @@ void carla_multiply(float data[], const float& multiplier, const std::size_t cou
if (!std::isfinite(data[i])) if (!std::isfinite(data[i]))
__builtin_unreachable(); __builtin_unreachable();
#endif #endif
*data++ *= multiplier;
data[i] *= multiplier;
} }
} }
} }


+ 5
- 5
source/utils/CarlaUtils.hpp View File

@@ -406,7 +406,7 @@ void carla_add(T dest[], const T src[], const std::size_t count) noexcept
CARLA_SAFE_ASSERT_RETURN(count > 0,); CARLA_SAFE_ASSERT_RETURN(count > 0,);


for (std::size_t i=0; i<count; ++i) for (std::size_t i=0; i<count; ++i)
*dest++ += *src++;
dest[i] += src[i];
} }


/* /*
@@ -422,7 +422,7 @@ void carla_addWithMultiply(T dest[], const T src[], const T& multiplier, const s
CARLA_SAFE_ASSERT_RETURN(count > 0,); CARLA_SAFE_ASSERT_RETURN(count > 0,);


for (std::size_t i=0; i<count; ++i) for (std::size_t i=0; i<count; ++i)
*dest++ += *src++ * multiplier;
dest[i] += src[i] * multiplier;
} }


/* /*
@@ -453,7 +453,7 @@ void carla_copyWithMultiply(T dest[], const T src[], const T& multiplier, const
CARLA_SAFE_ASSERT_RETURN(count > 0,); CARLA_SAFE_ASSERT_RETURN(count > 0,);


for (std::size_t i=0; i<count; ++i) for (std::size_t i=0; i<count; ++i)
*dest++ = *src++ * multiplier;
dest[i] = src[i] * multiplier;
} }


/* /*
@@ -473,7 +473,7 @@ void carla_fill(T data[], const T& value, const std::size_t count) noexcept
else else
{ {
for (std::size_t i=0; i<count; ++i) for (std::size_t i=0; i<count; ++i)
*data++ = value;
data[i] = value;
} }
} }


@@ -494,7 +494,7 @@ void carla_multiply(T data[], const T& multiplier, const std::size_t count) noex
else else
{ {
for (std::size_t i=0; i<count; ++i) for (std::size_t i=0; i<count; ++i)
*data++ *= multiplier;
data[i] *= multiplier;
} }
} }




Loading…
Cancel
Save