Copy-paste fix pattern
library CB-Math
fn main() {
u256 wide = 999
u8 byteValue = CB-Math.clamp(wide, 0, 255)
save byteValue
}
ClosedBit Docs
ClosedBit error docs
Unsafe truncation. A conversion would lose information, usually from a larger numeric lane into a smaller lane.
A conversion would lose information, usually from a larger numeric lane into a smaller lane.
Use an explicit clamp or choose a type wide enough to hold the value.
library CB-Math
fn main() {
u256 wide = 999
u8 byteValue = CB-Math.clamp(wide, 0, 255)
save byteValue
}