Skip to main content

clamp

Function clamp 

Source
pub fn clamp(value: I256, max: U256) -> I256
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].