Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit aa3d242

Browse files
committed
Clean up integers stored in MpTy
There isn't any need to cache the integer since it gets provided as an argument anyway. Simplify this in `jn` and `yn`.
1 parent 2d909e1 commit aa3d242

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

crates/libm-test/src/mpfloat.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,17 @@ macro_rules! impl_op_for_ty {
241241
}
242242

243243
impl MpOp for crate::op::[<jn $suffix>]::Routine {
244-
type MpTy = (i32, MpFloat);
244+
type MpTy = MpFloat;
245245

246246
fn new_mp() -> Self::MpTy {
247-
(0, new_mpfloat::<Self::FTy>())
247+
new_mpfloat::<Self::FTy>()
248248
}
249249

250250
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
251-
this.0 = input.0;
252-
this.1.assign(input.1);
253-
let ord = this.1.jn_round(this.0, Nearest);
254-
prep_retval::<Self::FTy>(&mut this.1, ord)
251+
let (n, x) = input;
252+
this.assign(x);
253+
let ord = this.jn_round(n, Nearest);
254+
prep_retval::<Self::FTy>(this, ord)
255255
}
256256
}
257257

@@ -274,17 +274,17 @@ macro_rules! impl_op_for_ty {
274274
}
275275

276276
impl MpOp for crate::op::[<yn $suffix>]::Routine {
277-
type MpTy = (i32, MpFloat);
277+
type MpTy = MpFloat;
278278

279279
fn new_mp() -> Self::MpTy {
280-
(0, new_mpfloat::<Self::FTy>())
280+
new_mpfloat::<Self::FTy>()
281281
}
282282

283283
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
284-
this.0 = input.0;
285-
this.1.assign(input.1);
286-
let ord = this.1.yn_round(this.0, Nearest);
287-
prep_retval::<Self::FTy>(&mut this.1, ord)
284+
let (n, x) = input;
285+
this.assign(x);
286+
let ord = this.yn_round(n, Nearest);
287+
prep_retval::<Self::FTy>(this, ord)
288288
}
289289
}
290290
}

0 commit comments

Comments
 (0)