aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-05-23 19:22:21 -0700
committerChris Robinson <[email protected]>2018-05-23 19:22:21 -0700
commit93de5350b9d41c4106bc6a6ccfc23e1bc5f48482 (patch)
tree309ca24720b2837584ed0a4a74b14307ea841cc5
parent9bf3ee722c338f367a65a75ec4d2353f259bc2af (diff)
Add some LIKELY and ASSUME statements
-rw-r--r--Alc/ALu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 72c3dd60..3cd8ed5c 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1610,7 +1610,7 @@ static void ApplyDistanceComp(ALfloat (*restrict Samples)[BUFFERSIZE], DistanceC
continue;
}
- if(SamplesToDo >= base)
+ if(LIKELY(SamplesToDo >= base))
{
for(i = 0;i < base;i++)
Values[i] = distbuf[i];
@@ -1638,6 +1638,9 @@ static void ApplyDither(ALfloat (*restrict Samples)[BUFFERSIZE], ALuint *dither_
ALuint seed = *dither_seed;
ALsizei c, i;
+ ASSUME(numchans > 0);
+ ASSUME(SamplesToDo > 0);
+
/* Dithering. Step 1, generate whitenoise (uniform distribution of random
* values between -1 and +1). Step 2 is to add the noise to the samples,
* before rounding and after scaling up to the desired quantization depth.
@@ -1690,6 +1693,10 @@ static void Write##A(const ALfloat (*restrict InBuffer)[BUFFERSIZE], \
ALsizei numchans) \
{ \
ALsizei i, j; \
+ \
+ ASSUME(numchans > 0); \
+ ASSUME(SamplesToDo > 0); \
+ \
for(j = 0;j < numchans;j++) \
{ \
const ALfloat *restrict in = ASSUME_ALIGNED(InBuffer[j], 16); \