From 93de5350b9d41c4106bc6a6ccfc23e1bc5f48482 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 23 May 2018 19:22:21 -0700 Subject: [PATCH] Add some LIKELY and ASSUME statements --- Alc/ALu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); \