@@ -43,7 +43,7 @@ extern int32_t paramNeutralValues[];
43
43
44
44
void functionsInit ();
45
45
46
- static inline void intToString (int32_t number, char * buffer) {
46
+ [[gnu::always_inline]] static inline void intToString (int32_t number, char * buffer) {
47
47
intToString (number, buffer, 1 );
48
48
}
49
49
@@ -60,7 +60,7 @@ void byteToHex(uint8_t number, char* buffer);
60
60
uint8_t hexToByte (char const * firstChar);
61
61
62
62
// bits must be *less* than 32! I.e. 31 or less
63
- inline int32_t signed_saturate_operand_unknown (int32_t val, int32_t bits) {
63
+ [[gnu::always_inline]] inline int32_t signed_saturate_operand_unknown (int32_t val, int32_t bits) {
64
64
65
65
// Despite having this switch at the per-audio-sample level, it doesn't introduce any slowdown compared to just always saturating by the same amount!
66
66
switch (bits) {
@@ -108,28 +108,28 @@ inline int32_t signed_saturate_operand_unknown(int32_t val, int32_t bits) {
108
108
}
109
109
110
110
template <uint8_t lshift>
111
- inline int32_t lshiftAndSaturate (int32_t val) {
111
+ [[gnu::always_inline]] inline int32_t lshiftAndSaturate (int32_t val) {
112
112
return signed_saturate<32 - lshift>(val) << lshift;
113
113
}
114
114
115
115
// lshift must be greater than 0! Not 0
116
- inline int32_t lshiftAndSaturateUnknown (int32_t val, uint8_t lshift) {
116
+ [[gnu::always_inline]] inline int32_t lshiftAndSaturateUnknown (int32_t val, uint8_t lshift) {
117
117
return signed_saturate_operand_unknown (val, 32 - lshift) << lshift;
118
118
}
119
119
120
- constexpr uint32_t charsToIntegerConstant (char a, char b, char c, char d) {
120
+ [[gnu::always_inline]] constexpr uint32_t charsToIntegerConstant (char a, char b, char c, char d) {
121
121
return (static_cast <uint32_t >(a)) | (static_cast <uint32_t >(b) << 8 ) | (static_cast <uint32_t >(c) << 16 )
122
122
| (static_cast <uint32_t >(d) << 24 );
123
123
}
124
124
125
- constexpr uint16_t charsToIntegerConstant (char a, char b) {
125
+ [[gnu::always_inline]] constexpr uint16_t charsToIntegerConstant (char a, char b) {
126
126
return (static_cast <uint16_t >(a)) | (static_cast <uint16_t >(b) << 8 );
127
127
}
128
128
/* *
129
129
* replace asterix with a digit
130
130
* Only works for single digits
131
131
*/
132
- constexpr void asterixToInt (char * str, int32_t i) {
132
+ [[gnu::always_inline]] constexpr void asterixToInt (char * str, int32_t i) {
133
133
while (*str != 0 ) {
134
134
if (*str == ' *' ) {
135
135
*str = (char )(' 0' + i);
@@ -228,7 +228,7 @@ bool paramNeedsLPF(int32_t p, bool fromAutomation);
228
228
int32_t shiftVolumeByDB (int32_t oldValue, float offset);
229
229
int32_t quickLog (uint32_t input);
230
230
231
- constexpr void convertFloatToIntAtMemoryLocation (uint32_t * pos) {
231
+ [[gnu::always_inline]] constexpr void convertFloatToIntAtMemoryLocation (uint32_t * pos) {
232
232
233
233
// *(int32_t*)pos = *(float*)pos * 2147483648;
234
234
@@ -244,7 +244,7 @@ constexpr void convertFloatToIntAtMemoryLocation(uint32_t* pos) {
244
244
*pos = outputValue;
245
245
}
246
246
247
- constexpr int32_t floatToInt (float theFloat) {
247
+ [[gnu::always_inline]] constexpr int32_t floatToInt (float theFloat) {
248
248
uint32_t readValue = std::bit_cast<uint32_t >(theFloat);
249
249
int32_t exponent = (int32_t )((readValue >> 23 ) & 255 ) - 127 ;
250
250
@@ -257,7 +257,7 @@ constexpr int32_t floatToInt(float theFloat) {
257
257
return outputValue;
258
258
}
259
259
260
- constexpr int32_t floatBitPatternToInt (uint32_t readValue) {
260
+ [[gnu::always_inline]] constexpr int32_t floatBitPatternToInt (uint32_t readValue) {
261
261
int32_t exponent = (int32_t )((readValue >> 23 ) & 255 ) - 127 ;
262
262
263
263
int32_t outputValue = (exponent >= 0 ) ? 2147483647 : (uint32_t )((readValue << 8 ) | 0x80000000 ) >> (-exponent);
@@ -270,7 +270,7 @@ constexpr int32_t floatBitPatternToInt(uint32_t readValue) {
270
270
}
271
271
272
272
// input must not have any extra bits set than numBitsInInput specifies
273
- inline int32_t interpolateTableSigned (uint32_t input, int32_t numBitsInInput, const int16_t * table,
273
+ [[gnu::always_inline]] inline int32_t interpolateTableSigned (uint32_t input, int32_t numBitsInInput, const int16_t * table,
274
274
int32_t numBitsInTableSize = 8 ) {
275
275
int32_t whichValue = input >> (numBitsInInput - numBitsInTableSize);
276
276
int32_t rshiftAmount = numBitsInInput - 16 - numBitsInTableSize;
@@ -290,7 +290,7 @@ uint32_t interpolateTableInverse(int32_t tableValueBig, int32_t numBitsInLookupO
290
290
291
291
// input must not have any extra bits set than numBitsInInput specifies
292
292
// Output of this function (unlike the regular 1d one) is only +- 1073741824
293
- inline int32_t interpolateTableSigned2d (uint32_t inputX, uint32_t inputY, int32_t numBitsInInputX,
293
+ [[gnu::always_inline]] inline int32_t interpolateTableSigned2d (uint32_t inputX, uint32_t inputY, int32_t numBitsInInputX,
294
294
int32_t numBitsInInputY, const int16_t * table, int32_t numBitsInTableSizeX,
295
295
int32_t numBitsInTableSizeY) {
296
296
@@ -317,7 +317,7 @@ inline int32_t interpolateTableSigned2d(uint32_t inputX, uint32_t inputY, int32_
317
317
}
318
318
319
319
template <unsigned saturationAmount>
320
- inline int32_t getTanH (int32_t input) {
320
+ [[gnu::always_inline]] inline int32_t getTanH (int32_t input) {
321
321
uint32_t workingValue;
322
322
323
323
if (saturationAmount)
@@ -339,7 +339,7 @@ inline int32_t getTanH(int32_t input) {
339
339
return interpolateTableSigned (workingValue, 32 , tanHSmall, 8 ) >> (saturationAmount + 2 );
340
340
}
341
341
342
- inline int32_t getTanHAntialiased (int32_t input, uint32_t * lastWorkingValue, uint32_t saturationAmount) {
342
+ [[gnu::always_inline]] inline int32_t getTanHAntialiased (int32_t input, uint32_t * lastWorkingValue, uint32_t saturationAmount) {
343
343
344
344
uint32_t workingValue = (uint32_t )lshiftAndSaturateUnknown (input, saturationAmount) + 2147483648u ;
345
345
@@ -349,15 +349,15 @@ inline int32_t getTanHAntialiased(int32_t input, uint32_t* lastWorkingValue, uin
349
349
return toReturn;
350
350
}
351
351
352
- inline int32_t getSine (uint32_t phase, uint8_t numBitsInInput = 32 ) {
352
+ [[gnu::always_inline]] inline int32_t getSine (uint32_t phase, uint8_t numBitsInInput = 32 ) {
353
353
return interpolateTableSigned (phase, numBitsInInput, sineWaveSmall, 8 );
354
354
}
355
355
356
- inline int32_t getSquare (uint32_t phase, uint32_t phaseWidth = 2147483648u ) {
356
+ [[gnu::always_inline]] inline int32_t getSquare (uint32_t phase, uint32_t phaseWidth = 2147483648u ) {
357
357
return ((phase >= phaseWidth) ? (-2147483648 ) : 2147483647 );
358
358
}
359
359
360
- inline int32_t getSquareSmall (uint32_t phase, uint32_t phaseWidth = 2147483648u ) {
360
+ [[gnu::always_inline]] inline int32_t getSquareSmall (uint32_t phase, uint32_t phaseWidth = 2147483648u ) {
361
361
return ((phase >= phaseWidth) ? (-1073741824 ) : 1073741823 );
362
362
}
363
363
@@ -367,13 +367,13 @@ inline int32_t getSquareSmall(uint32_t phase, uint32_t phaseWidth = 2147483648u)
367
367
phase *= multiplier;
368
368
*/
369
369
370
- inline int32_t getTriangleSmall (uint32_t phase) {
370
+ [[gnu::always_inline]] inline int32_t getTriangleSmall (uint32_t phase) {
371
371
if (phase >= 2147483648u )
372
372
phase = -phase;
373
373
return phase - 1073741824 ;
374
374
}
375
375
376
- inline int32_t getTriangle (uint32_t phase) {
376
+ [[gnu::always_inline]] inline int32_t getTriangle (uint32_t phase) {
377
377
return ((phase < 2147483648u ) ? 2 : -2 ) * phase + 2147483648u ;
378
378
// return getTriangleSmall(phase) << 1;
379
379
}
@@ -388,11 +388,11 @@ int32_t getDecay4(uint32_t input, uint8_t numBitsInInput);
388
388
389
389
extern uint32_t z, w, jcong;
390
390
391
- inline uint8_t getRandom255 () {
391
+ [[gnu::always_inline]] inline uint8_t getRandom255 () {
392
392
return CONG >> 24 ;
393
393
}
394
394
395
- inline int32_t getNoise () {
395
+ [[gnu::always_inline]] inline int32_t getNoise () {
396
396
return CONG;
397
397
}
398
398
@@ -503,14 +503,14 @@ inline void colorCopy(uint8_t* dest, uint8_t* src, uint8_t intensity, uint8_t br
503
503
dest[2 ] = (uint8_t )((src[2 ] * intensity / 255 ) / brightnessDivider);
504
504
}
505
505
506
- inline int32_t increaseMagnitude (int32_t number, int32_t magnitude) {
506
+ [[gnu::always_inline]] inline int32_t increaseMagnitude (int32_t number, int32_t magnitude) {
507
507
if (magnitude >= 0 )
508
508
return number << magnitude;
509
509
else
510
510
return number >> (-magnitude);
511
511
}
512
512
513
- inline int32_t increaseMagnitudeAndSaturate (int32_t number, int32_t magnitude) {
513
+ [[gnu::always_inline]] inline int32_t increaseMagnitudeAndSaturate (int32_t number, int32_t magnitude) {
514
514
if (magnitude > 0 )
515
515
return lshiftAndSaturateUnknown (number, magnitude);
516
516
else
@@ -524,27 +524,27 @@ int32_t divide_round_negative(int32_t dividend, int32_t divisor);
524
524
void dissectIterationDependence (int32_t probability, int32_t * getDivisor, int32_t * getWhichIterationWithinDivisor);
525
525
int32_t encodeIterationDependence (int32_t divisor, int32_t iterationWithinDivisor);
526
526
527
- inline uint32_t swapEndianness32 (uint32_t input) {
527
+ [[gnu::always_inline]] inline uint32_t swapEndianness32 (uint32_t input) {
528
528
int32_t out;
529
529
asm (" rev %0, %1" : " =r" (out) : " r" (input));
530
530
return out;
531
531
}
532
532
533
- inline uint32_t swapEndianness2x16 (uint32_t input) {
533
+ [[gnu::always_inline]] inline uint32_t swapEndianness2x16 (uint32_t input) {
534
534
int32_t out;
535
535
asm (" rev16 %0, %1" : " =r" (out) : " r" (input));
536
536
return out;
537
537
}
538
538
539
- inline int32_t getMagnitudeOld (uint32_t input) {
539
+ [[gnu::always_inline]] inline int32_t getMagnitudeOld (uint32_t input) {
540
540
return 32 - clz (input);
541
541
}
542
542
543
- inline int32_t getMagnitude (uint32_t input) {
543
+ [[gnu::always_inline]] inline int32_t getMagnitude (uint32_t input) {
544
544
return 31 - clz (input);
545
545
}
546
546
547
- inline bool isPowerOfTwo (uint32_t input) {
547
+ [[gnu::always_inline]] inline bool isPowerOfTwo (uint32_t input) {
548
548
return (input == 1 << getMagnitude (input));
549
549
}
550
550
@@ -560,12 +560,12 @@ void getNoteLengthNameFromMagnitude(char* text, int32_t magnitude, bool clarifyP
560
560
bool doesFilenameFitPrefixFormat (char const * fileName, char const * filePrefix, int32_t prefixLength);
561
561
int32_t fresultToDelugeErrorCode (FRESULT result);
562
562
563
- inline void writeInt16 (char ** address, uint16_t number) {
563
+ [[gnu::always_inline]] inline void writeInt16 (char ** address, uint16_t number) {
564
564
*(uint16_t *)*address = number;
565
565
*address += 2 ;
566
566
}
567
567
568
- inline void writeInt32 (char ** address, uint32_t number) {
568
+ [[gnu::always_inline]] inline void writeInt32 (char ** address, uint32_t number) {
569
569
*(uint32_t *)*address = number;
570
570
*address += 4 ;
571
571
}
0 commit comments