libpcm: fix buggy use of clip macro (evaluates its arg twice)

This commit is contained in:
cinap_lenrek 2024-11-22 22:47:28 +00:00
parent b9955e29d1
commit 0676a1ba51

View file

@ -52,7 +52,15 @@ enum {
#define MAXINT ((int)(~0UL>>1)) #define MAXINT ((int)(~0UL>>1))
#define MININT (MAXINT+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 static int
chaninit(Chan *c, int irate, int orate, int count, uintptr caller) chaninit(Chan *c, int irate, int orate, int count, uintptr caller)