Skip to content

Commit

Permalink
feat: feature gate uint > u32::MAX to 64 bit architectures (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
benluelo authored Sep 15, 2023
1 parent 163a6ae commit 64de5c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build/generic_const_mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,25 @@ pub mod generic_const_mappings {
write!(
f,
"
{cfg}
impl ToUInt for Const<{uint}> {{
type Output = U{uint};
}}
\
",
uint = uint,
cfg = feature_gate_to_64_bit(uint),
)?;
}
write!(f, "}}")?;
f.flush()?;
Ok(())
}

const fn feature_gate_to_64_bit(uint: u64) -> &'static str {
if uint > u32::MAX as u64 {
r#"#[cfg(target_pointer_width = "64")]"#
} else {
""
}
}

0 comments on commit 64de5c6

Please sign in to comment.