Use clamping functions instead of the min/max macros