x = maxv(a,minv(x,b))
x = clamp(x,1,10); // x can't be smaller than 1 and greater than 10
► latest version online