Skip to content

Commit

Permalink
Fix potential wrong-over-optimization in math utilities
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Jan 2, 2024
1 parent 46792aa commit 73ddea2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions source/utils/CarlaMathUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void carla_addFloats(float dest[], const float src[], const std::size_t count) n
if (!std::isfinite(src[i]))
__builtin_unreachable();
#endif
*dest++ += *src++;
dest[i] += src[i];
}
}

Expand Down Expand Up @@ -217,7 +217,7 @@ void carla_fillFloatsWithSingleValue(float data[], const float& value, const std
if (!std::isfinite(data[i]))
__builtin_unreachable();
#endif
*data++ = value;
data[i] = value;
}
}
}
Expand Down Expand Up @@ -302,7 +302,7 @@ void carla_multiply(float data[], const float& multiplier, const std::size_t cou
if (!std::isfinite(data[i]))
__builtin_unreachable();
#endif
*data++ *= multiplier;
data[i] *= multiplier;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions source/utils/CarlaUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,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];
}

/*
Expand All @@ -422,7 +422,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;
}

/*
Expand Down Expand Up @@ -453,7 +453,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;
}

/*
Expand All @@ -473,7 +473,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;
}
}

Expand All @@ -494,7 +494,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;
}
}

Expand Down

0 comments on commit 73ddea2

Please sign in to comment.