use super::helpers::{
reverse_multiply_assign, reverse_multiply_c_long, reverse_multiply_c_long_assign,
};
use crate::integer::Integer;
use core::ops::Mul;
impl Mul<Integer> for Integer {
type Output = Integer;
fn mul(mut self, rhs: Integer) -> Self::Output {
Integer::multiply_assign(&mut self, &rhs);
self
}
}
impl Mul<&Integer> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &Integer) -> Self::Output {
Integer::multiply_assign(&mut self, rhs);
self
}
}
impl Mul<Integer> for &Integer {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for &Integer {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
Integer::multiply(self, rhs)
}
}
impl Mul<i8> for Integer {
type Output = Integer;
fn mul(mut self, rhs: i8) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, rhs);
self
}
}
impl Mul<&i8> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &i8) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, *rhs);
self
}
}
impl Mul<i8> for &Integer {
type Output = Integer;
fn mul(self, rhs: i8) -> Self::Output {
Integer::multiply_c_long(self, rhs)
}
}
impl Mul<&i8> for &Integer {
type Output = Integer;
fn mul(self, rhs: &i8) -> Self::Output {
Integer::multiply_c_long(self, *rhs)
}
}
impl Mul<Integer> for i8 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for i8 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(self, rhs)
}
}
impl Mul<Integer> for &i8 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for &i8 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(*self, rhs)
}
}
impl Mul<u8> for Integer {
type Output = Integer;
fn mul(mut self, rhs: u8) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, rhs);
self
}
}
impl Mul<&u8> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &u8) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, *rhs);
self
}
}
impl Mul<u8> for &Integer {
type Output = Integer;
fn mul(self, rhs: u8) -> Self::Output {
Integer::multiply_c_long(self, rhs)
}
}
impl Mul<&u8> for &Integer {
type Output = Integer;
fn mul(self, rhs: &u8) -> Self::Output {
Integer::multiply_c_long(self, *rhs)
}
}
impl Mul<Integer> for u8 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for u8 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(self, rhs)
}
}
impl Mul<Integer> for &u8 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for &u8 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(*self, rhs)
}
}
impl Mul<i16> for Integer {
type Output = Integer;
fn mul(mut self, rhs: i16) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, rhs);
self
}
}
impl Mul<&i16> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &i16) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, *rhs);
self
}
}
impl Mul<i16> for &Integer {
type Output = Integer;
fn mul(self, rhs: i16) -> Self::Output {
Integer::multiply_c_long(self, rhs)
}
}
impl Mul<&i16> for &Integer {
type Output = Integer;
fn mul(self, rhs: &i16) -> Self::Output {
Integer::multiply_c_long(self, *rhs)
}
}
impl Mul<Integer> for i16 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for i16 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(self, rhs)
}
}
impl Mul<Integer> for &i16 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for &i16 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(*self, rhs)
}
}
impl Mul<u16> for Integer {
type Output = Integer;
fn mul(mut self, rhs: u16) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, rhs);
self
}
}
impl Mul<&u16> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &u16) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, *rhs);
self
}
}
impl Mul<u16> for &Integer {
type Output = Integer;
fn mul(self, rhs: u16) -> Self::Output {
Integer::multiply_c_long(self, rhs)
}
}
impl Mul<&u16> for &Integer {
type Output = Integer;
fn mul(self, rhs: &u16) -> Self::Output {
Integer::multiply_c_long(self, *rhs)
}
}
impl Mul<Integer> for u16 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for u16 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(self, rhs)
}
}
impl Mul<Integer> for &u16 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for &u16 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(*self, rhs)
}
}
impl Mul<i32> for Integer {
type Output = Integer;
fn mul(mut self, rhs: i32) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, rhs);
self
}
}
impl Mul<&i32> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &i32) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, *rhs);
self
}
}
impl Mul<i32> for &Integer {
type Output = Integer;
fn mul(self, rhs: i32) -> Self::Output {
Integer::multiply_c_long(self, rhs)
}
}
impl Mul<&i32> for &Integer {
type Output = Integer;
fn mul(self, rhs: &i32) -> Self::Output {
Integer::multiply_c_long(self, *rhs)
}
}
impl Mul<Integer> for i32 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for i32 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(self, rhs)
}
}
impl Mul<Integer> for &i32 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Mul<&Integer> for &i32 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(*self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<u32> for Integer {
type Output = Integer;
fn mul(mut self, rhs: u32) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&u32> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &u32) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, *rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<u32> for &Integer {
type Output = Integer;
fn mul(self, rhs: u32) -> Self::Output {
Integer::multiply_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&u32> for &Integer {
type Output = Integer;
fn mul(self, rhs: &u32) -> Self::Output {
Integer::multiply_c_long(self, *rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<Integer> for u32 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&Integer> for u32 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<Integer> for &u32 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(*self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&Integer> for &u32 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(*self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<i64> for Integer {
type Output = Integer;
fn mul(mut self, rhs: i64) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&i64> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &i64) -> Self::Output {
Integer::multiply_c_long_assign(&mut self, *rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<i64> for &Integer {
type Output = Integer;
fn mul(self, rhs: i64) -> Self::Output {
Integer::multiply_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&i64> for &Integer {
type Output = Integer;
fn mul(self, rhs: &i64) -> Self::Output {
Integer::multiply_c_long(self, *rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<Integer> for i64 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&Integer> for i64 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<Integer> for &i64 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_c_long_assign(*self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Mul<&Integer> for &i64 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
reverse_multiply_c_long(*self, rhs)
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<u32> for Integer {
type Output = Integer;
fn mul(mut self, rhs: u32) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&u32> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &u32) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(*rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<u32> for &Integer {
type Output = Integer;
fn mul(self, rhs: u32) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&u32> for &Integer {
type Output = Integer;
fn mul(self, rhs: &u32) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<Integer> for u32 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&Integer> for u32 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<Integer> for &u32 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&Integer> for &u32 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<i64> for Integer {
type Output = Integer;
fn mul(mut self, rhs: i64) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&i64> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &i64) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(*rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<i64> for &Integer {
type Output = Integer;
fn mul(self, rhs: i64) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&i64> for &Integer {
type Output = Integer;
fn mul(self, rhs: &i64) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<Integer> for i64 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&Integer> for i64 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<Integer> for &i64 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Mul<&Integer> for &i64 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
impl Mul<u64> for Integer {
type Output = Integer;
fn mul(mut self, rhs: u64) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(rhs));
self
}
}
impl Mul<&u64> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &u64) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(*rhs));
self
}
}
impl Mul<u64> for &Integer {
type Output = Integer;
fn mul(self, rhs: u64) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
impl Mul<&u64> for &Integer {
type Output = Integer;
fn mul(self, rhs: &u64) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
impl Mul<Integer> for u64 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(self), &mut rhs);
rhs
}
}
impl Mul<&Integer> for u64 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
impl Mul<Integer> for &u64 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
impl Mul<&Integer> for &u64 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
impl Mul<i128> for Integer {
type Output = Integer;
fn mul(mut self, rhs: i128) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(rhs));
self
}
}
impl Mul<&i128> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &i128) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(*rhs));
self
}
}
impl Mul<i128> for &Integer {
type Output = Integer;
fn mul(self, rhs: i128) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
impl Mul<&i128> for &Integer {
type Output = Integer;
fn mul(self, rhs: &i128) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
impl Mul<Integer> for i128 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(self), &mut rhs);
rhs
}
}
impl Mul<&Integer> for i128 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
impl Mul<Integer> for &i128 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
impl Mul<&Integer> for &i128 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
impl Mul<u128> for Integer {
type Output = Integer;
fn mul(mut self, rhs: u128) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(rhs));
self
}
}
impl Mul<&u128> for Integer {
type Output = Integer;
fn mul(mut self, rhs: &u128) -> Self::Output {
Integer::multiply_assign(&mut self, &Integer::from(*rhs));
self
}
}
impl Mul<u128> for &Integer {
type Output = Integer;
fn mul(self, rhs: u128) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
impl Mul<&u128> for &Integer {
type Output = Integer;
fn mul(self, rhs: &u128) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_multiply_assign(self, &mut rhs);
rhs
}
}
impl Mul<Integer> for u128 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(self), &mut rhs);
rhs
}
}
impl Mul<&Integer> for u128 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}
impl Mul<Integer> for &u128 {
type Output = Integer;
fn mul(self, mut rhs: Integer) -> Self::Output {
reverse_multiply_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
impl Mul<&Integer> for &u128 {
type Output = Integer;
fn mul(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::multiply_assign(&mut lhs, rhs);
lhs
}
}