sdk: Use u32::MAX from std to unbreak BPF builds (#16171) (#16172)

(cherry picked from commit aabe186e3f)

Co-authored-by: Justin Starry <justin@solana.com>
This commit is contained in:
mergify[bot]
2021-03-27 17:05:53 +00:00
committed by GitHub
parent 92ec1ae255
commit 76a6576976

View File

@ -98,9 +98,9 @@ fn visit_byte(elem: u8, val: u16, nth_byte: usize) -> VisitResult {
} }
let shift = u32::try_from(nth_byte) let shift = u32::try_from(nth_byte)
.unwrap_or(u32::MAX) .unwrap_or(std::u32::MAX)
.saturating_mul(7); .saturating_mul(7);
let elem_val = elem_val.checked_shl(shift).unwrap_or(u32::MAX); let elem_val = elem_val.checked_shl(shift).unwrap_or(std::u32::MAX);
let new_val = val | elem_val; let new_val = val | elem_val;
let val = u16::try_from(new_val).map_err(|_| VisitError::Overflow(new_val))?; let val = u16::try_from(new_val).map_err(|_| VisitError::Overflow(new_val))?;