LMMS
Loading...
Searching...
No Matches
juce_FloatVectorOperations.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26#ifndef JUCE_SNAP_TO_ZERO
27 #if JUCE_INTEL
28 #define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8f || n > 1.0e-8f)) n = 0;
29 #else
30 #define JUCE_SNAP_TO_ZERO(n) ignoreUnused (n)
31 #endif
32#endif
33class ScopedNoDenormals;
34
35//==============================================================================
53template <typename FloatType, typename CountType>
55{
57 static void JUCE_CALLTYPE clear (FloatType* dest, CountType numValues) noexcept;
58
60 static void JUCE_CALLTYPE fill (FloatType* dest, FloatType valueToFill, CountType numValues) noexcept;
61
63 static void JUCE_CALLTYPE copy (FloatType* dest, const FloatType* src, CountType numValues) noexcept;
64
66 static void JUCE_CALLTYPE copyWithMultiply (FloatType* dest, const FloatType* src, FloatType multiplier, CountType numValues) noexcept;
67
69 static void JUCE_CALLTYPE add (FloatType* dest, FloatType amountToAdd, CountType numValues) noexcept;
70
72 static void JUCE_CALLTYPE add (FloatType* dest, const FloatType* src, FloatType amount, CountType numValues) noexcept;
73
75 static void JUCE_CALLTYPE add (FloatType* dest, const FloatType* src, CountType numValues) noexcept;
76
78 static void JUCE_CALLTYPE add (FloatType* dest, const FloatType* src1, const FloatType* src2, CountType num) noexcept;
79
81 static void JUCE_CALLTYPE subtract (FloatType* dest, const FloatType* src, CountType numValues) noexcept;
82
84 static void JUCE_CALLTYPE subtract (FloatType* dest, const FloatType* src1, const FloatType* src2, CountType num) noexcept;
85
87 static void JUCE_CALLTYPE addWithMultiply (FloatType* dest, const FloatType* src, FloatType multiplier, CountType numValues) noexcept;
88
90 static void JUCE_CALLTYPE addWithMultiply (FloatType* dest, const FloatType* src1, const FloatType* src2, CountType num) noexcept;
91
93 static void JUCE_CALLTYPE subtractWithMultiply (FloatType* dest, const FloatType* src, FloatType multiplier, CountType numValues) noexcept;
94
96 static void JUCE_CALLTYPE subtractWithMultiply (FloatType* dest, const FloatType* src1, const FloatType* src2, CountType num) noexcept;
97
99 static void JUCE_CALLTYPE multiply (FloatType* dest, const FloatType* src, CountType numValues) noexcept;
100
102 static void JUCE_CALLTYPE multiply (FloatType* dest, const FloatType* src1, const FloatType* src2, CountType numValues) noexcept;
103
105 static void JUCE_CALLTYPE multiply (FloatType* dest, FloatType multiplier, CountType numValues) noexcept;
106
108 static void JUCE_CALLTYPE multiply (FloatType* dest, const FloatType* src, FloatType multiplier, CountType num) noexcept;
109
111 static void JUCE_CALLTYPE negate (FloatType* dest, const FloatType* src, CountType numValues) noexcept;
112
114 static void JUCE_CALLTYPE abs (FloatType* dest, const FloatType* src, CountType numValues) noexcept;
115
117 static void JUCE_CALLTYPE min (FloatType* dest, const FloatType* src, FloatType comp, CountType num) noexcept;
118
120 static void JUCE_CALLTYPE min (FloatType* dest, const FloatType* src1, const FloatType* src2, CountType num) noexcept;
121
123 static void JUCE_CALLTYPE max (FloatType* dest, const FloatType* src, FloatType comp, CountType num) noexcept;
124
126 static void JUCE_CALLTYPE max (FloatType* dest, const FloatType* src1, const FloatType* src2, CountType num) noexcept;
127
129 static void JUCE_CALLTYPE clip (FloatType* dest, const FloatType* src, FloatType low, FloatType high, CountType num) noexcept;
130
132 static Range<FloatType> JUCE_CALLTYPE findMinAndMax (const FloatType* src, CountType numValues) noexcept;
133
135 static FloatType JUCE_CALLTYPE findMinimum (const FloatType* src, CountType numValues) noexcept;
136
138 static FloatType JUCE_CALLTYPE findMaximum (const FloatType* src, CountType numValues) noexcept;
139};
140
141#if ! DOXYGEN
142namespace detail
143{
144
145template <typename...>
147
148template <typename Head>
149struct NameForwarder<Head> : Head {};
150
151template <typename Head, typename... Tail>
152struct NameForwarder<Head, Tail...> : Head, NameForwarder<Tail...>
153{
154 using Head::clear;
155 using NameForwarder<Tail...>::clear;
156
157 using Head::fill;
158 using NameForwarder<Tail...>::fill;
159
160 using Head::copy;
161 using NameForwarder<Tail...>::copy;
162
163 using Head::copyWithMultiply;
164 using NameForwarder<Tail...>::copyWithMultiply;
165
166 using Head::add;
167 using NameForwarder<Tail...>::add;
168
169 using Head::subtract;
170 using NameForwarder<Tail...>::subtract;
171
172 using Head::addWithMultiply;
173 using NameForwarder<Tail...>::addWithMultiply;
174
175 using Head::subtractWithMultiply;
176 using NameForwarder<Tail...>::subtractWithMultiply;
177
178 using Head::multiply;
179 using NameForwarder<Tail...>::multiply;
180
181 using Head::negate;
182 using NameForwarder<Tail...>::negate;
183
184 using Head::abs;
185 using NameForwarder<Tail...>::abs;
186
187 using Head::min;
188 using NameForwarder<Tail...>::min;
189
190 using Head::max;
191 using NameForwarder<Tail...>::max;
192
193 using Head::clip;
194 using NameForwarder<Tail...>::clip;
195
196 using Head::findMinAndMax;
197 using NameForwarder<Tail...>::findMinAndMax;
198
199 using Head::findMinimum;
200 using NameForwarder<Tail...>::findMinimum;
201
202 using Head::findMaximum;
203 using NameForwarder<Tail...>::findMaximum;
204};
205
206} // namespace detail
207#endif
208
209//==============================================================================
219class JUCE_API FloatVectorOperations : public detail::NameForwarder<FloatVectorOperationsBase<float, int>,
220 FloatVectorOperationsBase<float, size_t>,
221 FloatVectorOperationsBase<double, int>,
222 FloatVectorOperationsBase<double, size_t>>
223{
224public:
225 static void JUCE_CALLTYPE convertFixedToFloat (float* dest, const int* src, float multiplier, int num) noexcept;
226
227 static void JUCE_CALLTYPE convertFixedToFloat (float* dest, const int* src, float multiplier, size_t num) noexcept;
228
230 static void JUCE_CALLTYPE enableFlushToZeroMode (bool shouldEnable) noexcept;
231
238 static void JUCE_CALLTYPE disableDenormalisedNumberSupport (bool shouldDisable = true) noexcept;
239
241 static bool JUCE_CALLTYPE areDenormalsDisabled() noexcept;
242
243private:
245
247 static void JUCE_CALLTYPE setFpStatusRegister (intptr_t) noexcept;
248};
249
250//==============================================================================
258{
259public:
260 ScopedNoDenormals() noexcept;
261 ~ScopedNoDenormals() noexcept;
262
263private:
264 #if JUCE_USE_SSE_INTRINSICS || (JUCE_USE_ARM_NEON || defined (__arm64__) || defined (__aarch64__))
265 intptr_t fpsr;
266 #endif
267};
268
269} // namespace juce
#define copy(x)
Definition ADnoteParameters.cpp:1011
#define noexcept
Definition DistrhoDefines.h:72
float abs(const fft_t *freqs, off_t x)
Definition OscilGen.cpp:52
Definition juce_FloatVectorOperations.h:223
static void JUCE_CALLTYPE disableDenormalisedNumberSupport(bool shouldDisable=true) noexcept
Definition juce_FloatVectorOperations.cpp:1494
static void JUCE_CALLTYPE enableFlushToZeroMode(bool shouldEnable) noexcept
Definition juce_FloatVectorOperations.cpp:1477
friend ScopedNoDenormals
Definition juce_FloatVectorOperations.h:244
static void JUCE_CALLTYPE setFpStatusRegister(intptr_t) noexcept
Definition juce_FloatVectorOperations.cpp:1452
static intptr_t JUCE_CALLTYPE getFpStatusRegister() noexcept
Definition juce_FloatVectorOperations.cpp:1430
static bool JUCE_CALLTYPE areDenormalsDisabled() noexcept
Definition juce_FloatVectorOperations.cpp:1513
static void JUCE_CALLTYPE convertFixedToFloat(float *dest, const int *src, float multiplier, int num) noexcept
Definition juce_FloatVectorOperations.cpp:1425
Definition juce_Range.h:40
ScopedNoDenormals() noexcept
Definition juce_FloatVectorOperations.cpp:1528
#define JUCE_CALLTYPE
#define JUCE_API
Definition juce_StandardHeader.h:152
static int JUCE_CDECL comp(const void *a, const void *b)
Definition lsp.c:298
Definition juce_FloatVectorOperations.h:143
Definition carla_juce.cpp:31
void findMinAndMax(const Type *values, int numValues, Type &lowest, Type &highest)
Definition juce_MathsFunctions.h:219
Type findMaximum(const Type *values, Size numValues)
Definition juce_MathsFunctions.h:199
Type findMinimum(const Type *data, Size numValues)
Definition juce_MathsFunctions.h:179
#define min(x, y)
Definition os.h:74
#define max(x, y)
Definition os.h:78
Definition juce_FloatVectorOperations.h:55
static void JUCE_CALLTYPE add(FloatType *dest, FloatType amountToAdd, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1212
static FloatType JUCE_CALLTYPE findMinimum(const FloatType *src, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1402
static void JUCE_CALLTYPE multiply(FloatType *dest, const FloatType *src, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1299
static void JUCE_CALLTYPE clear(FloatType *dest, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1180
static void JUCE_CALLTYPE addWithMultiply(FloatType *dest, const FloatType *src, FloatType multiplier, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1263
static Range< FloatType > JUCE_CALLTYPE findMinAndMax(const FloatType *src, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1395
static void JUCE_CALLTYPE clip(FloatType *dest, const FloatType *src, FloatType low, FloatType high, CountType num) noexcept
Definition juce_FloatVectorOperations.cpp:1385
static FloatType JUCE_CALLTYPE findMaximum(const FloatType *src, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1409
static void JUCE_CALLTYPE subtractWithMultiply(FloatType *dest, const FloatType *src, FloatType multiplier, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1281
static void JUCE_CALLTYPE copyWithMultiply(FloatType *dest, const FloatType *src, FloatType multiplier, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1203
static void JUCE_CALLTYPE fill(FloatType *dest, FloatType valueToFill, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1187
static void JUCE_CALLTYPE subtract(FloatType *dest, const FloatType *src, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1246
static void JUCE_CALLTYPE negate(FloatType *dest, const FloatType *src, CountType numValues) noexcept
Definition juce_FloatVectorOperations.cpp:1333
Definition juce_FloatVectorOperations.h:146