@@ -17,7 +17,7 @@ pub enum WasmValue {
1717 /// A 64-bit float.
1818 F64 ( f64 ) ,
1919 // /// A 128-bit vector
20- V128 ( i128 ) ,
20+ V128 ( [ u8 ; 16 ] ) ,
2121 RefExtern ( ExternRef ) ,
2222 RefFunc ( FuncRef ) ,
2323}
@@ -176,7 +176,7 @@ impl WasmValue {
176176 WasmType :: I64 => Self :: I64 ( 0 ) ,
177177 WasmType :: F32 => Self :: F32 ( 0.0 ) ,
178178 WasmType :: F64 => Self :: F64 ( 0.0 ) ,
179- WasmType :: V128 => Self :: V128 ( 0 ) ,
179+ WasmType :: V128 => Self :: V128 ( [ 0 ; 16 ] ) ,
180180 WasmType :: RefFunc => Self :: RefFunc ( FuncRef :: null ( ) ) ,
181181 WasmType :: RefExtern => Self :: RefExtern ( ExternRef :: null ( ) ) ,
182182 }
@@ -188,11 +188,7 @@ impl WasmValue {
188188 match ( self , other) {
189189 ( Self :: I32 ( a) , Self :: I32 ( b) ) => a == b,
190190 ( Self :: I64 ( a) , Self :: I64 ( b) ) => a == b,
191- ( Self :: V128 ( a) , Self :: V128 ( b) ) => {
192- let a_bytes = a. to_le_bytes ( ) ;
193- let b_bytes = b. to_le_bytes ( ) ;
194- a_bytes == b_bytes || Self :: v128_nan_eq ( a_bytes, b_bytes)
195- }
191+ ( Self :: V128 ( a) , Self :: V128 ( b) ) => a == b || Self :: v128_nan_eq ( * a, * b) ,
196192 ( Self :: RefExtern ( addr) , Self :: RefExtern ( addr2) ) => addr == addr2,
197193 ( Self :: RefFunc ( addr) , Self :: RefFunc ( addr2) ) => addr == addr2,
198194 ( Self :: F32 ( a) , Self :: F32 ( b) ) => {
@@ -293,8 +289,8 @@ impl WasmValue {
293289 }
294290 }
295291
296- /// Return the `i128` from a `WasmValue`, if it is a `V128`.
297- pub const fn as_v128 ( & self ) -> Option < i128 > {
292+ /// Return the raw little-endian bytes from a `WasmValue`, if it is a `V128`.
293+ pub const fn as_v128 ( & self ) -> Option < [ u8 ; 16 ] > {
298294 match self {
299295 Self :: V128 ( i) => Some ( * i) ,
300296 _ => None ,
@@ -394,4 +390,4 @@ macro_rules! impl_conversion_for_wasmvalue {
394390 }
395391}
396392
397- impl_conversion_for_wasmvalue ! { i32 => I32 , i64 => I64 , f32 => F32 , f64 => F64 , i128 => V128 , ExternRef => RefExtern , FuncRef => RefFunc }
393+ impl_conversion_for_wasmvalue ! { i32 => I32 , i64 => I64 , f32 => F32 , f64 => F64 , [ u8 ; 16 ] => V128 , ExternRef => RefExtern , FuncRef => RefFunc }
0 commit comments