wasmer_compiler_singlepass/common_decl.rs
1#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2pub enum Size {
3 S8,
4 S16,
5 S32,
6 S64,
7}
8
9impl Size {
10 #[allow(dead_code)]
11 pub fn bits(&self) -> u32 {
12 8 * self.bytes()
13 }
14
15 pub fn bytes(&self) -> u32 {
16 match self {
17 Size::S8 => 1,
18 Size::S16 => 2,
19 Size::S32 => 4,
20 Size::S64 => 8,
21 }
22 }
23}