added clamp macro