Skip to content

Commit

Permalink
fix float_minimum_maximum
Browse files Browse the repository at this point in the history
  • Loading branch information
neri committed Jun 11, 2024
1 parent 50cf318 commit 451802d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 40 deletions.
44 changes: 4 additions & 40 deletions src/cg/intr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -963,30 +963,12 @@ impl WasmInterpreter<'_> {
}
WasmImInstruction::F32Min => {
Self::binary_op(code, &mut value_stack, |lhs, rhs| unsafe {
lhs.map_f32(|lhs| {
let rhs = rhs.get_f32();
if lhs.is_nan() {
lhs
} else if rhs.is_nan() {
rhs
} else {
lhs.min(rhs)
}
});
lhs.map_f32(|lhs| lhs.minimum(rhs.get_f32()));
});
}
WasmImInstruction::F32Max => {
Self::binary_op(code, &mut value_stack, |lhs, rhs| unsafe {
lhs.map_f32(|lhs| {
let rhs = rhs.get_f32();
if lhs.is_nan() {
lhs
} else if rhs.is_nan() {
rhs
} else {
lhs.max(rhs)
}
});
lhs.map_f32(|lhs| lhs.maximum(rhs.get_f32()));
});
}
WasmImInstruction::F32Copysign => {
Expand Down Expand Up @@ -1084,30 +1066,12 @@ impl WasmInterpreter<'_> {
}
WasmImInstruction::F64Min => {
Self::binary_op(code, &mut value_stack, |lhs, rhs| unsafe {
lhs.map_f64(|lhs| {
let rhs = rhs.get_f64();
if lhs.is_nan() {
lhs
} else if rhs.is_nan() {
rhs
} else {
lhs.min(rhs)
}
});
lhs.map_f64(|lhs| lhs.minimum(rhs.get_f64()));
});
}
WasmImInstruction::F64Max => {
Self::binary_op(code, &mut value_stack, |lhs, rhs| unsafe {
lhs.map_f64(|lhs| {
let rhs = rhs.get_f64();
if lhs.is_nan() {
lhs
} else if rhs.is_nan() {
rhs
} else {
lhs.max(rhs)
}
});
lhs.map_f64(|lhs| lhs.maximum(rhs.get_f64()));
});
}
WasmImInstruction::F64Copysign => {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#![cfg_attr(not(test), no_std)]
#![deny(unsafe_op_in_unsafe_fn)]
//
#![feature(float_minimum_maximum)]
#![feature(negative_impls)]
#![feature(assert_matches)]
//
Expand Down

0 comments on commit 451802d

Please sign in to comment.