summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/audio/pcmconv/pcmconv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/src/cmd/audio/pcmconv/pcmconv.c b/sys/src/cmd/audio/pcmconv/pcmconv.c
index 0c9cba35c..3adda141a 100644
--- a/sys/src/cmd/audio/pcmconv/pcmconv.c
+++ b/sys/src/cmd/audio/pcmconv/pcmconv.c
@@ -209,12 +209,13 @@ dither(int *y, int ibits, int obits, int count)
{
static ulong prnd;
- if(ibits >= 32 || ibits >= obits)
+ if(ibits >= 32 || obits >= ibits)
return;
while(count--){
prnd = (prnd*0x19660dL + 0x3c6ef35fL) & 0xffffffffL;
- *y++ += ((int)prnd) >> ibits;
+ *y = clip((vlong)*y + ((int)prnd >> ibits));
+ y++;
}
}