summaryrefslogtreecommitdiff
path: root/crates/types
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2024-02-26 15:30:42 +0100
committerHenry Gressmann <mail@henrygressmann.de>2024-02-26 15:30:42 +0100
commit0fa1bca956229fa49509524aa7edd087439ea39a (patch)
tree753139f1a58eba501cbf3a53291a56a67afd133b /crates/types
parent43e6d23ae8806c813dd5fa0663c17c1772ebf5a8 (diff)
chore: preperations for simd support
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/types')
-rw-r--r--crates/types/src/value.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/types/src/value.rs b/crates/types/src/value.rs
index 24fed3b..3c02e55 100644
--- a/crates/types/src/value.rs
+++ b/crates/types/src/value.rs
@@ -16,6 +16,8 @@ pub enum WasmValue {
F32(f32),
/// A 64-bit float.
F64(f64),
+ /// A half of a 128-bit vector. Allways used in pairs.
+ V128(u128),
RefExtern(ExternAddr),
RefFunc(FuncAddr),
@@ -47,6 +49,7 @@ impl WasmValue {
ValType::I64 => Self::I64(0),
ValType::F32 => Self::F32(0.0),
ValType::F64 => Self::F64(0.0),
+ ValType::V128 => Self::V128(0),
ValType::RefFunc => Self::RefNull(ValType::RefFunc),
ValType::RefExtern => Self::RefNull(ValType::RefExtern),
}
@@ -89,6 +92,7 @@ impl Debug for WasmValue {
WasmValue::I64(i) => write!(f, "i64({})", i),
WasmValue::F32(i) => write!(f, "f32({})", i),
WasmValue::F64(i) => write!(f, "f64({})", i),
+ WasmValue::V128(i) => write!(f, "v128.half({:?})", i),
WasmValue::RefExtern(addr) => write!(f, "ref.extern({:?})", addr),
WasmValue::RefFunc(addr) => write!(f, "ref.func({:?})", addr),
WasmValue::RefNull(ty) => write!(f, "ref.null({:?})", ty),
@@ -105,6 +109,7 @@ impl WasmValue {
Self::I64(_) => ValType::I64,
Self::F32(_) => ValType::F32,
Self::F64(_) => ValType::F64,
+ Self::V128(_) => ValType::V128,
Self::RefExtern(_) => ValType::RefExtern,
Self::RefFunc(_) => ValType::RefFunc,
Self::RefNull(ty) => *ty,
@@ -124,6 +129,8 @@ pub enum ValType {
F32,
/// A 64-bit float.
F64,
+ /// A half of a 128-bit vector. Allways used in pairs.
+ V128,
/// A reference to a function.
RefFunc,
/// A reference to an external value.