Browse Source

Fix potential wrong-over-optimization in math utilities

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.8
falkTX 10 months ago
parent
commit
623920c887
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 10 additions and 10 deletions
  1. +4
    -4
      source/utils/CarlaMathUtils.hpp
  2. +6
    -6
      source/utils/CarlaUtils.hpp

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

@@ -1,6 +1,6 @@
/*
* Carla math utils
* Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2024 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -177,7 +177,7 @@ void carla_addFloats(float dest[], const float src[], const std::size_t count) n
__builtin_unreachable();
if (!std::isfinite(src[i]))
__builtin_unreachable();
*dest++ += *src++;
dest[i] += src[i];
}
}

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


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

@@ -1,6 +1,6 @@
/*
* Carla common utils
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2024 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -441,7 +441,7 @@ void carla_add(T dest[], const T src[], const std::size_t count) noexcept
CARLA_SAFE_ASSERT_RETURN(count > 0,);

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

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

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

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

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

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

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



Loading…
Cancel
Save