Skip to main content

clamp

Function clamp 

Source
pub fn clamp(value: Signed<256, 4>, max: Uint<256, 4>) -> Signed<256, 4>
Expand description

Clamps a signed integer to the range [-(max+1), max] to match real signed type ranges. For example, i128 range is [-2^127, 2^127-1], not [-2^127+1, 2^127-1].