diff options
| author | Henry <mail@henrygressmann.de> | 2026-07-15 16:23:02 +0200 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2026-07-15 16:23:02 +0200 |
| commit | 957b62bf1d6205409bac94a4ced790dfb8007e3d (patch) | |
| tree | 4e7e580c4bb187c57e4e2dfb3ffe7fef5a1771bf /crates/types/src | |
| parent | f99b3a90827406b48657d63d7c1f0188ddd68c8f (diff) | |
fix: 64 bit table addressing
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/types/src')
| -rw-r--r-- | crates/types/src/lib.rs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index e918e46..fcac23c 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -499,22 +499,34 @@ impl Default for GlobalType { } } -#[derive(Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq)] #[cfg_attr(feature = "debug", derive(Debug))] #[cfg_attr(feature = "archive", derive(serde::Serialize, serde::Deserialize))] pub struct TableType { + arch: MemoryArch, pub element_type: WasmType, - pub size_initial: u32, - pub size_max: Option<u32>, + pub size_initial: u64, + pub size_max: Option<u64>, } impl TableType { - pub fn empty() -> Self { - Self { element_type: WasmType::RefFunc, size_initial: 0, size_max: None } + pub const fn empty() -> Self { + Self::new(WasmType::RefFunc, 0, None) + } + + /// Create a table with 32-bit indices. + pub const fn new(element_type: WasmType, size_initial: u64, size_max: Option<u64>) -> Self { + Self { arch: MemoryArch::I32, element_type, size_initial, size_max } } - pub fn new(element_type: WasmType, size_initial: u32, size_max: Option<u32>) -> Self { - Self { element_type, size_initial, size_max } + /// Create a table with 64-bit indices. + pub const fn new64(element_type: WasmType, size_initial: u64, size_max: Option<u64>) -> Self { + Self { arch: MemoryArch::I64, element_type, size_initial, size_max } + } + + #[inline] + pub const fn arch(&self) -> MemoryArch { + self.arch } } |
