MathUtil.clamp: avoid Math.min/max

(They're variadic, and so result in array creation)