Explicit casting

This commit is contained in:
Paul Ferrand 2020-01-04 17:38:51 +01:00
parent ef425d638a
commit ab6d1c5d02
31 changed files with 171 additions and 153 deletions

View file

@ -21,8 +21,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <benchmark/benchmark.h>
#include "Config.h"
#include "ADSREnvelope.h"
#include <benchmark/benchmark.h>
#include <algorithm>
#include <random>
#include <numeric>
@ -44,12 +45,12 @@ static void Point(benchmark::State& state) {
for (auto _ : state) {
envelope.reset(attack, release, 1.0, fixedAmount, decay, fixedAmount);
envelope.startRelease(releaseTime);
for(int offset = 0; offset < envelopeSize; offset += state.range(0))
for(int offset = 0; offset < envelopeSize; offset += static_cast<int>(state.range(0)))
for (auto& out: output)
out = envelope.getNextValue();
benchmark::DoNotOptimize(output);
}
state.counters["Per block"] = benchmark::Counter(envelopeSize / state.range(0), benchmark::Counter::kIsRate);
state.counters["Per block"] = benchmark::Counter(envelopeSize / static_cast<double>(state.range(0)), benchmark::Counter::kIsRate);
}
static void Block(benchmark::State& state) {
@ -58,12 +59,12 @@ static void Block(benchmark::State& state) {
for (auto _ : state) {
envelope.reset(attack, release, 1.0, fixedAmount, decay, fixedAmount);
envelope.startRelease(releaseTime);
for(int offset = 0; offset < envelopeSize; offset += state.range(0))
for(int offset = 0; offset < envelopeSize; offset += static_cast<int>(state.range(0)))
envelope.getBlock(absl::MakeSpan(output));
benchmark::DoNotOptimize(output);
}
state.counters["Per block"] = benchmark::Counter(envelopeSize / state.range(0), benchmark::Counter::kIsRate);
state.counters["Per block"] = benchmark::Counter(envelopeSize / static_cast<double>(state.range(0)), benchmark::Counter::kIsRate);
}
BENCHMARK(Point)->RangeMultiplier(2)->Range((2<<6), (2<<11));

View file

@ -21,6 +21,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Config.h"
#include <benchmark/benchmark.h>
#include <absl/types/span.h>
#include <random>

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
class AddArray : public benchmark::Fixture {
public:

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
class CopyArray : public benchmark::Fixture {
public:

View file

@ -21,20 +21,20 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
class CumArray : public benchmark::Fixture {
public:
void SetUp(const ::benchmark::State& state) {
std::random_device rd { };
std::mt19937 gen { rd() };
std::uniform_real_distribution<float> dist { 0.1, 1 };
std::uniform_real_distribution<float> dist { 0.1f, 1.0f };
input = std::vector<float>(state.range(0));
output = std::vector<float>(state.range(0));
std::generate(input.begin(), input.end(), [&]() { return dist(gen); });

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
#include "absl/types/span.h"
class DiffArray : public benchmark::Fixture {
@ -35,7 +35,7 @@ public:
void SetUp(const ::benchmark::State& state) {
std::random_device rd { };
std::mt19937 gen { rd() };
std::uniform_real_distribution<float> dist { 0.1, 1 };
std::uniform_real_distribution<float> dist { 0.1f, 1.0f };
input = std::vector<float>(state.range(0));
output = std::vector<float>(state.range(0));
std::generate(input.begin(), input.end(), [&]() { return dist(gen); });

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
class Divide : public benchmark::Fixture {

View file

@ -21,6 +21,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
@ -28,7 +29,6 @@
#include <cmath>
#include <iostream>
#include "EventEnvelopes.h"
#include "SIMDHelpers.h"
#include "absl/types/span.h"
#include "FloatEnvelopes.cpp"
@ -59,7 +59,7 @@ BENCHMARK_DEFINE_F(EnvelopeFixture, Linear)(benchmark::State& state) {
sfz::LinearEnvelope<float> envelope;
for (auto _ : state)
{
envelope.registerEvent(state.range(0) - 1, dist(gen));
envelope.registerEvent(static_cast<int>(state.range(0) - 1), dist(gen));
envelope.getBlock(absl::MakeSpan(output));
}
}
@ -68,7 +68,7 @@ BENCHMARK_DEFINE_F(EnvelopeFixture, LinearQuantized)(benchmark::State& state) {
sfz::LinearEnvelope<float> envelope;
for (auto _ : state)
{
envelope.registerEvent(state.range(0) - 1, dist(gen));
envelope.registerEvent(static_cast<int>(state.range(0) - 1), dist(gen));
envelope.getQuantizedBlock(absl::MakeSpan(output), 0.5);
}
}
@ -77,7 +77,7 @@ BENCHMARK_DEFINE_F(EnvelopeFixture, Multiplicative)(benchmark::State& state) {
sfz::MultiplicativeEnvelope<float> envelope;
for (auto _ : state)
{
envelope.registerEvent(state.range(0) - 1, dist(gen));
envelope.registerEvent(static_cast<int>(state.range(0) - 1), dist(gen));
envelope.getBlock(absl::MakeSpan(output));
}
}
@ -86,7 +86,7 @@ BENCHMARK_DEFINE_F(EnvelopeFixture, MultiplicativeQuantized)(benchmark::State& s
sfz::MultiplicativeEnvelope<float> envelope;
for (auto _ : state)
{
envelope.registerEvent(state.range(0) - 1, dist(gen));
envelope.registerEvent(static_cast<int>(state.range(0) - 1), dist(gen));
envelope.getQuantizedBlock(absl::MakeSpan(output), 1.5);
}
}

View file

@ -21,8 +21,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <benchmark/benchmark.h>
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include "Buffer.h"
#include <algorithm>
#include <random>

View file

@ -20,12 +20,12 @@
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Buffer.h"
#include <benchmark/benchmark.h>
#include <sndfile.hh>
#define DR_FLAC_IMPLEMENTATION
#include "dr_flac.h"
#include "ghc/filesystem.hpp"
#include "Buffer.h"
#include <memory>
#ifndef NDEBUG
#include <iostream>

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
class GainSingle : public benchmark::Fixture {
public:

View file

@ -21,12 +21,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <vector>
#include <random>
#include <numeric>
#include <absl/algorithm/container.h>
#include "SIMDHelpers.h"
// In this one we have an array of jumps

View file

@ -22,11 +22,11 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <benchmark/benchmark.h>
#include "SIMDHelpers.h"
#include <vector>
#include <random>
#include <numeric>
#include <absl/algorithm/container.h>
#include "SIMDHelpers.h"
// In this one we have an array of indices

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
class MultiplyAdd : public benchmark::Fixture {
public:

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
#include "Config.h"
#include "absl/types/span.h"
@ -36,7 +36,7 @@ public:
void SetUp(const ::benchmark::State& state) {
std::random_device rd { };
std::mt19937 gen { rd() };
std::uniform_real_distribution<float> dist { 0.001, 1 };
std::uniform_real_distribution<float> dist { 0.001f, 1.0f };
pan = std::vector<float>(state.range(0));
left = std::vector<float>(state.range(0));
right = std::vector<float>(state.range(0));

View file

@ -21,10 +21,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <absl/algorithm/container.h>
#include "SIMDHelpers.h"
#include "absl/types/span.h"
constexpr int bigNumber { 2399132 };
@ -34,7 +34,7 @@ public:
void SetUp(const ::benchmark::State& state [[maybe_unused]]) {
std::random_device rd { };
std::mt19937 gen { rd() };
std::uniform_real_distribution<float> dist { 0.001, 1 };
std::uniform_real_distribution<float> dist { 0.001f, 1.0f };
std::uniform_int_distribution<int> jumpDist { 0, 3 };
source = std::vector<float>(bigNumber);
result.resize(state.range(0));

View file

@ -21,9 +21,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include "SIMDHelpers.h"
#include "Buffer.h"

View file

@ -20,11 +20,11 @@
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include "Buffer.h"
#include <benchmark/benchmark.h>
#include <sndfile.hh>
#include "ghc/filesystem.hpp"
#include "Buffer.h"
#include "SIMDHelpers.h"
#define DR_WAV_IMPLEMENTATION
#include "dr_wav.h"
#include "AudioBuffer.h"

View file

@ -21,9 +21,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <benchmark/benchmark.h>
#include "SIMDHelpers.h"
#include "Buffer.h"
#include <benchmark/benchmark.h>
#include <algorithm>
#include <numeric>
#include <absl/types/span.h>

View file

@ -20,11 +20,11 @@
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Buffer.h"
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <sndfile.hh>
#include "ghc/filesystem.hpp"
#include "Buffer.h"
#include "SIMDHelpers.h"
#include "Oversampler.h"
#include "AudioBuffer.h"
#include <memory>
@ -139,14 +139,14 @@ BENCHMARK_DEFINE_F(FileFixture, ResampleAtOnce)(benchmark::State& state) {
sndfile.readf(buffer.data(), numFrames);
sfz::readInterleaved<float>(buffer, output->getSpan(0), output->getSpan(1));
upsampler2x.process_block(temp.data(), output->channelReader(0), numFrames);
upsampler4x.process_block(output->channelWriter(0), temp.data(), numFrames * 2);
upsampler2x.process_block(temp.data(), output->channelReader(0), static_cast<long>(numFrames));
upsampler4x.process_block(output->channelWriter(0), temp.data(), static_cast<long>(numFrames * 2));
upsampler2x.clear_buffers();
upsampler4x.clear_buffers();
upsampler2x.process_block(temp.data(), output->channelReader(1), numFrames);
upsampler4x.process_block(output->channelWriter(1), temp.data(), numFrames * 2);
upsampler2x.process_block(temp.data(), output->channelReader(1), static_cast<long>(numFrames));
upsampler4x.process_block(output->channelWriter(1), temp.data(), static_cast<long>(numFrames * 2));
}
}
@ -189,11 +189,11 @@ BENCHMARK_DEFINE_F(FileFixture, ResampleInChunks)(benchmark::State& state) {
sfz::readInterleaved<float>(bufferChunk, leftSpan, rightSpan);
upsampler2xLeft.process_block(chunkSpan.data(), leftSpan.data(), thisChunkSize);
upsampler4xLeft.process_block(output->channelWriter(0) + outputFrameCounter, chunkSpan.data(), thisChunkSize * 2);
upsampler2xLeft.process_block(chunkSpan.data(), leftSpan.data(), static_cast<long>(thisChunkSize));
upsampler4xLeft.process_block(output->channelWriter(0) + outputFrameCounter, chunkSpan.data(), static_cast<long>(thisChunkSize * 2));
upsampler2xRight.process_block(chunkSpan.data(), rightSpan.data(), thisChunkSize);
upsampler4xRight.process_block(output->channelWriter(1) + outputFrameCounter, chunkSpan.data(), thisChunkSize * 2);
upsampler2xRight.process_block(chunkSpan.data(), rightSpan.data(), static_cast<long>(thisChunkSize));
upsampler4xRight.process_block(output->channelWriter(1) + outputFrameCounter, chunkSpan.data(), static_cast<long>(thisChunkSize * 2));
inputFrameCounter += chunkSize;
outputFrameCounter += chunkSize * 4;

View file

@ -21,12 +21,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <vector>
#include <random>
#include <numeric>
#include <absl/algorithm/container.h>
#include "SIMDHelpers.h"
// In this one we have an array of indices

View file

@ -21,13 +21,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SIMDHelpers.h"
#include <benchmark/benchmark.h>
#include <random>
#include <numeric>
#include <vector>
#include <cmath>
#include <iostream>
#include "SIMDHelpers.h"
class SubArray : public benchmark::Fixture {
public:

View file

@ -20,12 +20,12 @@
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Buffer.h"
#include <benchmark/benchmark.h>
#include <sndfile.hh>
#define DR_WAV_IMPLEMENTATION
#include "dr_wav.h"
#include "ghc/filesystem.hpp"
#include "Buffer.h"
#include <memory>
#ifndef NDEBUG
#include <iostream>

View file

@ -21,9 +21,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <benchmark/benchmark.h>
#include "SIMDHelpers.h"
#include "Buffer.h"
#include <benchmark/benchmark.h>
#include <algorithm>
#include <numeric>
#include <absl/types/span.h>

View file

@ -77,18 +77,18 @@ _PI32_CONST(2, 2);
_PI32_CONST(4, 4);
_PI32_CONST(0x7f, 0x7f);
_PS_CONST(cephes_SQRTHF, 0.707106781186547524);
_PS_CONST(cephes_log_p0, 7.0376836292E-2);
_PS_CONST(cephes_log_p1, - 1.1514610310E-1);
_PS_CONST(cephes_log_p2, 1.1676998740E-1);
_PS_CONST(cephes_log_p3, - 1.2420140846E-1);
_PS_CONST(cephes_log_p4, + 1.4249322787E-1);
_PS_CONST(cephes_log_p5, - 1.6668057665E-1);
_PS_CONST(cephes_log_p6, + 2.0000714765E-1);
_PS_CONST(cephes_log_p7, - 2.4999993993E-1);
_PS_CONST(cephes_log_p8, + 3.3333331174E-1);
_PS_CONST(cephes_log_q1, -2.12194440e-4);
_PS_CONST(cephes_log_q2, 0.693359375);
_PS_CONST(cephes_SQRTHF, 0.707106781186547524f);
_PS_CONST(cephes_log_p0, 7.0376836292E-2f);
_PS_CONST(cephes_log_p1, - 1.1514610310E-1f);
_PS_CONST(cephes_log_p2, 1.1676998740E-1f);
_PS_CONST(cephes_log_p3, - 1.2420140846E-1f);
_PS_CONST(cephes_log_p4, + 1.4249322787E-1f);
_PS_CONST(cephes_log_p5, - 1.6668057665E-1f);
_PS_CONST(cephes_log_p6, + 2.0000714765E-1f);
_PS_CONST(cephes_log_p7, - 2.4999993993E-1f);
_PS_CONST(cephes_log_p8, + 3.3333331174E-1f);
_PS_CONST(cephes_log_q1, -2.12194440e-4f);
_PS_CONST(cephes_log_q2, 0.693359375f);
#ifndef USE_SSE2
typedef union xmm_mm_union {
@ -202,16 +202,16 @@ v4sf log_ps(v4sf x) {
_PS_CONST(exp_hi, 88.3762626647949f);
_PS_CONST(exp_lo, -88.3762626647949f);
_PS_CONST(cephes_LOG2EF, 1.44269504088896341);
_PS_CONST(cephes_exp_C1, 0.693359375);
_PS_CONST(cephes_exp_C2, -2.12194440e-4);
_PS_CONST(cephes_LOG2EF, 1.44269504088896341f);
_PS_CONST(cephes_exp_C1, 0.693359375f);
_PS_CONST(cephes_exp_C2, -2.12194440e-4f);
_PS_CONST(cephes_exp_p0, 1.9875691500E-4);
_PS_CONST(cephes_exp_p1, 1.3981999507E-3);
_PS_CONST(cephes_exp_p2, 8.3334519073E-3);
_PS_CONST(cephes_exp_p3, 4.1665795894E-2);
_PS_CONST(cephes_exp_p4, 1.6666665459E-1);
_PS_CONST(cephes_exp_p5, 5.0000001201E-1);
_PS_CONST(cephes_exp_p0, 1.9875691500E-4f);
_PS_CONST(cephes_exp_p1, 1.3981999507E-3f);
_PS_CONST(cephes_exp_p2, 8.3334519073E-3f);
_PS_CONST(cephes_exp_p3, 4.1665795894E-2f);
_PS_CONST(cephes_exp_p4, 1.6666665459E-1f);
_PS_CONST(cephes_exp_p5, 5.0000001201E-1f);
v4sf exp_ps(v4sf x) {
v4sf tmp = _mm_setzero_ps(), fx;
@ -291,16 +291,16 @@ v4sf exp_ps(v4sf x) {
return y;
}
_PS_CONST(minus_cephes_DP1, -0.78515625);
_PS_CONST(minus_cephes_DP2, -2.4187564849853515625e-4);
_PS_CONST(minus_cephes_DP3, -3.77489497744594108e-8);
_PS_CONST(sincof_p0, -1.9515295891E-4);
_PS_CONST(sincof_p1, 8.3321608736E-3);
_PS_CONST(sincof_p2, -1.6666654611E-1);
_PS_CONST(coscof_p0, 2.443315711809948E-005);
_PS_CONST(coscof_p1, -1.388731625493765E-003);
_PS_CONST(coscof_p2, 4.166664568298827E-002);
_PS_CONST(cephes_FOPI, 1.27323954473516); // 4 / M_PI
_PS_CONST(minus_cephes_DP1, -0.78515625f);
_PS_CONST(minus_cephes_DP2, -2.4187564849853515625e-4f);
_PS_CONST(minus_cephes_DP3, -3.77489497744594108e-8f);
_PS_CONST(sincof_p0, -1.9515295891E-4f);
_PS_CONST(sincof_p1, 8.3321608736E-3f);
_PS_CONST(sincof_p2, -1.6666654611E-1f);
_PS_CONST(coscof_p0, 2.443315711809948E-005f);
_PS_CONST(coscof_p1, -1.388731625493765E-003f);
_PS_CONST(coscof_p2, 4.166664568298827E-002f);
_PS_CONST(cephes_FOPI, 1.27323954473516f); // 4 / M_PI
/* evaluation of 4 sines at onces, using only SSE1+MMX intrinsics so

View file

@ -70,7 +70,7 @@ Type ADSREnvelope<Type>::getNextValue() noexcept
return start;
currentState = State::Attack;
step = (1.0 - currentValue) / (attack > 0 ? attack : 1);
step = (static_cast<Type>(1.0) - currentValue) / (attack > 0 ? attack : 1);
[[fallthrough]];
case State::Attack:
if (attack-- > 0) {

View file

@ -68,6 +68,21 @@ public:
bytes.fetch_sub(size);
}
void bufferDeleted(size_t size)
{
bufferDeleted(static_cast<int>(size));
}
void bufferResized(size_t oldSize, size_t newSize)
{
bufferResized(static_cast<int>(oldSize), static_cast<int>(newSize));
}
void newBuffer(size_t size)
{
newBuffer(static_cast<int>(size));
}
int getNumBuffers() { return numBuffers; }
int getTotalBytes() { return bytes; }
private:
@ -165,7 +180,7 @@ public:
*/
void clear()
{
counter().bufferResized(largerSize * sizeof(value_type), 0);
counter().bufferResized(largerSize * sizeof(value_type), static_cast<size_t>(0));
largerSize = 0;
alignedSize = 0;
std::free(paddedData);

View file

@ -167,7 +167,7 @@ void LinearEnvelope<Type>::getQuantizedBlock(absl::Span<Type> output, Type quant
continue;
}
const int numSteps = difference / quantizationStep;
const auto numSteps = static_cast<int>(difference / quantizationStep);
const auto stepLength = static_cast<int>(length / numSteps);
for (int i = 0; i < numSteps; ++i) {
fill<Type>(output.subspan(index, stepLength), currentValue);
@ -257,7 +257,7 @@ void MultiplicativeEnvelope<Type>::getQuantizedBlock(absl::Span<Type> output, Ty
continue;
}
const int numSteps = std::log(difference) / logStep;
const auto numSteps = static_cast<int>(std::log(difference) / logStep);
const auto stepLength = static_cast<int>(length / numSteps);
for (int i = 0; i < numSteps; ++i) {
fill<Type>(output.subspan(index, stepLength), currentValue);

View file

@ -29,6 +29,7 @@
* @date 2019-11-23
*/
#pragma once
#include "Config.h"
#include <algorithm>
#include <cmath>
#include <cassert>
@ -156,14 +157,14 @@ constexpr ValueType linearInterpolation(ValueType left, ValueType right, ValueTy
}
template <class Type>
constexpr Type pi { 3.141592653589793238462643383279502884 };
constexpr Type pi { static_cast<Type>(3.141592653589793238462643383279502884) };
template <class Type>
constexpr Type twoPi { 2 * pi<Type> };
constexpr Type twoPi { static_cast<Type>(2) * pi<Type> };
template <class Type>
constexpr Type piTwo { pi<Type> / 2 };
constexpr Type piTwo { pi<Type> / static_cast<Type>(2) };
template <class Type>
constexpr Type piFour { pi<Type> / 4 };
constexpr Type piFour { pi<Type> / static_cast<Type>(4) };
template <class Type>
constexpr Type sqrtTwo { 1.414213562373095048801688724209698078569671875376948073176 };
constexpr Type sqrtTwo { static_cast<Type>(1.414213562373095048801688724209698078569671875376948073176) };
template <class Type>
constexpr Type sqrtTwoInv { 0.707106781186547524400844362104849039284835937688474036588 };
constexpr Type sqrtTwoInv { static_cast<Type>(0.707106781186547524400844362104849039284835937688474036588) };

View file

@ -22,7 +22,6 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Parser.h"
#include "Config.h"
#include "StringViewHelpers.h"
#include "SfzHelpers.h"
#include "absl/strings/str_join.h"

View file

@ -22,6 +22,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include "Config.h"
#include "Opcode.h"
#include "ghc/fs_std.hpp"
#include <map>