Function constrain

Source
fn constrain(diff: i32, threshold: i32, damping: i32) -> i32