Skip to content

Commit ded44b8

Browse files
authored
[wasmparser] implement From<u128> and From<i128> for V128 (#2428)
This mirrors Ieee32/Ieee64.
1 parent c5cc6d4 commit ded44b8

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

crates/wasmparser/src/readers/core/operators.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,18 @@ impl From<V128> for u128 {
295295
}
296296
}
297297

298+
impl From<i128> for V128 {
299+
fn from(value: i128) -> Self {
300+
V128(i128::to_le_bytes(value))
301+
}
302+
}
303+
304+
impl From<u128> for V128 {
305+
fn from(value: u128) -> Self {
306+
V128(u128::to_le_bytes(value))
307+
}
308+
}
309+
298310
/// Represents the memory ordering for atomic instructions.
299311
///
300312
/// For an in-depth explanation of memory orderings, see the C++ documentation

0 commit comments

Comments
 (0)