Initial (incomplete) implementation of transmutability trait.
This initial implementation handles transmutations between types with specified layouts, except when references are involved. Co-authored-by: Igor null <m1el.2027@gmail.com>
This commit is contained in:
parent
2a220937c2
commit
bc4a1dea41
91 changed files with 5691 additions and 2 deletions
|
@ -508,6 +508,7 @@ impl fmt::Debug for Align {
|
|||
|
||||
impl Align {
|
||||
pub const ONE: Align = Align { pow2: 0 };
|
||||
pub const MAX: Align = Align { pow2: 29 };
|
||||
|
||||
#[inline]
|
||||
pub fn from_bits(bits: u64) -> Result<Align, String> {
|
||||
|
@ -540,7 +541,7 @@ impl Align {
|
|||
if bytes != 1 {
|
||||
return Err(not_power_of_2(align));
|
||||
}
|
||||
if pow2 > 29 {
|
||||
if pow2 > Self::MAX.pow2 {
|
||||
return Err(too_large(align));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue