mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 15:59:20 +03:00
Remove unusable variants from Align enum
I discovered today that Wasmer throws an error if you use "higher than natural" alignment in a store instruction. So let's take them out of the enum.
This commit is contained in:
parent
8a1a164544
commit
a25101b378
@ -84,7 +84,9 @@ impl std::fmt::Debug for VmBlock<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wasm memory alignment. (Rust representation matches Wasm encoding)
|
||||
/// Wasm memory alignment for load/store instructions.
|
||||
/// Rust representation matches Wasm encoding.
|
||||
/// It's an error to specify alignment higher than the "natural" alignment of the instruction
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum Align {
|
||||
@ -92,10 +94,6 @@ pub enum Align {
|
||||
Bytes2 = 1,
|
||||
Bytes4 = 2,
|
||||
Bytes8 = 3,
|
||||
Bytes16 = 4,
|
||||
Bytes32 = 5,
|
||||
Bytes64 = 6,
|
||||
// ... we can add more if we need them ...
|
||||
}
|
||||
|
||||
impl From<u32> for Align {
|
||||
@ -105,9 +103,6 @@ impl From<u32> for Align {
|
||||
2 => Align::Bytes2,
|
||||
4 => Align::Bytes4,
|
||||
8 => Align::Bytes8,
|
||||
16 => Align::Bytes16,
|
||||
32 => Align::Bytes32,
|
||||
64 => Align::Bytes64,
|
||||
_ => panic!("{:?}-byte alignment not supported", x),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user