ref: 0676a1ba51784e2b44ce9100965e4554e13e48b9
parent: b9955e29d1d82686979611e01a2e1f60283af58a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Nov 22 17:47:28 EST 2024
libpcm: fix buggy use of clip macro (evaluates its arg twice)
--- a/sys/src/libpcm/conv.c
+++ b/sys/src/libpcm/conv.c
@@ -52,7 +52,15 @@
#define MAXINT ((int)(~0UL>>1))
#define MININT (MAXINT+1)
-#define clip(v) ((v) > MAXINT ? MAXINT : ((v) < MININT ? MININT : (v)))
+static int
+clip(vlong v)
+{
+ if(v > MAXINT)
+ return MAXINT;
+ if(v < MININT)
+ return MININT;
+ return v;
+}
static int
chaninit(Chan *c, int irate, int orate, int count, uintptr caller)
--
⑨