1use std::ops::{Mul, MulAssign};
5use crate::ops::{onforward_ref_binop, onforward_ref_op_assign};
6use crate::prim::{typ::*, mpf::*};
7
8onforward_ref_binop!{impl Mul, mul for mpf_s, mpf_s, mpf_s}
9
10impl<'a, 'b> Mul<&'b mpf_s> for &'a mpf_s {
12 type Output = <mpf_s as Mul<mpf_s>>::Output;
13
14 #[inline]
16 fn mul(self, rhs: &'b mpf_s) -> <mpf_s as Mul<mpf_s>>::Output {
17 let mut t = mpf_s::init();
18 mpf_mul(&mut t, self, rhs);
19 t
20 }
21}
22
23onforward_ref_binop!{impl Mul, mul for mpf_s, ui_t, mpf_s}
24
25impl<'a, 'b> Mul<&'b ui_t> for &'a mpf_s {
27 type Output = <mpf_s as Mul<ui_t>>::Output;
28
29 #[inline]
31 fn mul(self, rhs: &'b ui_t) -> <mpf_s as Mul<ui_t>>::Output {
32 let mut t = mpf_s::init();
33 mpf_mul_ui(&mut t, self, *rhs);
34 t
35 }
36}
37
38onforward_ref_binop!{impl Mul, mul for ui_t, mpf_s, mpf_s}
39
40impl<'a, 'b> Mul<&'b mpf_s> for &'a ui_t {
42 type Output = <mpf_s as Mul<mpf_s>>::Output;
43
44 #[inline]
46 fn mul(self, rhs: &'b mpf_s) -> <mpf_s as Mul<mpf_s>>::Output {
47 let mut t = mpf_s::init();
48 mpf_mul_ui(&mut t, rhs, *self);
49 t
50 }
51}
52
53onforward_ref_op_assign!{impl MulAssign, mul_assign for mpf_s, mpf_s}
54
55impl<'a> MulAssign<&'a Self> for mpf_s {
57 #[inline]
59 fn mul_assign(&mut self, rhs: &'a Self) -> () {
60 self.mul(rhs);
61 }
62}
63
64onforward_ref_op_assign!{impl MulAssign, mul_assign for mpf_s, ui_t}
65
66impl<'a> MulAssign<&'a ui_t> for mpf_s {
68 #[inline]
70 fn mul_assign(&mut self, rhs: &'a ui_t) -> () {
71 self.mul_ui(*rhs);
72 }
73}