use super::helpers::{reverse_add_assign, reverse_add_c_long, reverse_add_c_long_assign};
use crate::integer::Integer;
use core::ops::Add;
impl Add<Integer> for Integer {
type Output = Integer;
fn add(mut self, rhs: Integer) -> Self::Output {
Integer::add_assign(&mut self, &rhs);
self
}
}
impl Add<&Integer> for Integer {
type Output = Integer;
fn add(mut self, rhs: &Integer) -> Self::Output {
Integer::add_assign(&mut self, rhs);
self
}
}
impl Add<Integer> for &Integer {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(self, &mut rhs);
rhs
}
}
impl Add<&Integer> for &Integer {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
Integer::add(self, rhs)
}
}
impl Add<i8> for Integer {
type Output = Integer;
fn add(mut self, rhs: i8) -> Self::Output {
Integer::add_c_long_assign(&mut self, rhs);
self
}
}
impl Add<&i8> for Integer {
type Output = Integer;
fn add(mut self, rhs: &i8) -> Self::Output {
Integer::add_c_long_assign(&mut self, *rhs);
self
}
}
impl Add<i8> for &Integer {
type Output = Integer;
fn add(self, rhs: i8) -> Self::Output {
Integer::add_c_long(self, rhs)
}
}
impl Add<&i8> for &Integer {
type Output = Integer;
fn add(self, rhs: &i8) -> Self::Output {
Integer::add_c_long(self, *rhs)
}
}
impl Add<Integer> for i8 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(self, &mut rhs);
rhs
}
}
impl Add<&Integer> for i8 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(self, rhs)
}
}
impl Add<Integer> for &i8 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Add<&Integer> for &i8 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(*self, rhs)
}
}
impl Add<u8> for Integer {
type Output = Integer;
fn add(mut self, rhs: u8) -> Self::Output {
Integer::add_c_long_assign(&mut self, rhs);
self
}
}
impl Add<&u8> for Integer {
type Output = Integer;
fn add(mut self, rhs: &u8) -> Self::Output {
Integer::add_c_long_assign(&mut self, *rhs);
self
}
}
impl Add<u8> for &Integer {
type Output = Integer;
fn add(self, rhs: u8) -> Self::Output {
Integer::add_c_long(self, rhs)
}
}
impl Add<&u8> for &Integer {
type Output = Integer;
fn add(self, rhs: &u8) -> Self::Output {
Integer::add_c_long(self, *rhs)
}
}
impl Add<Integer> for u8 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(self, &mut rhs);
rhs
}
}
impl Add<&Integer> for u8 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(self, rhs)
}
}
impl Add<Integer> for &u8 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Add<&Integer> for &u8 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(*self, rhs)
}
}
impl Add<i16> for Integer {
type Output = Integer;
fn add(mut self, rhs: i16) -> Self::Output {
Integer::add_c_long_assign(&mut self, rhs);
self
}
}
impl Add<&i16> for Integer {
type Output = Integer;
fn add(mut self, rhs: &i16) -> Self::Output {
Integer::add_c_long_assign(&mut self, *rhs);
self
}
}
impl Add<i16> for &Integer {
type Output = Integer;
fn add(self, rhs: i16) -> Self::Output {
Integer::add_c_long(self, rhs)
}
}
impl Add<&i16> for &Integer {
type Output = Integer;
fn add(self, rhs: &i16) -> Self::Output {
Integer::add_c_long(self, *rhs)
}
}
impl Add<Integer> for i16 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(self, &mut rhs);
rhs
}
}
impl Add<&Integer> for i16 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(self, rhs)
}
}
impl Add<Integer> for &i16 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Add<&Integer> for &i16 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(*self, rhs)
}
}
impl Add<u16> for Integer {
type Output = Integer;
fn add(mut self, rhs: u16) -> Self::Output {
Integer::add_c_long_assign(&mut self, rhs);
self
}
}
impl Add<&u16> for Integer {
type Output = Integer;
fn add(mut self, rhs: &u16) -> Self::Output {
Integer::add_c_long_assign(&mut self, *rhs);
self
}
}
impl Add<u16> for &Integer {
type Output = Integer;
fn add(self, rhs: u16) -> Self::Output {
Integer::add_c_long(self, rhs)
}
}
impl Add<&u16> for &Integer {
type Output = Integer;
fn add(self, rhs: &u16) -> Self::Output {
Integer::add_c_long(self, *rhs)
}
}
impl Add<Integer> for u16 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(self, &mut rhs);
rhs
}
}
impl Add<&Integer> for u16 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(self, rhs)
}
}
impl Add<Integer> for &u16 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Add<&Integer> for &u16 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(*self, rhs)
}
}
impl Add<i32> for Integer {
type Output = Integer;
fn add(mut self, rhs: i32) -> Self::Output {
Integer::add_c_long_assign(&mut self, rhs);
self
}
}
impl Add<&i32> for Integer {
type Output = Integer;
fn add(mut self, rhs: &i32) -> Self::Output {
Integer::add_c_long_assign(&mut self, *rhs);
self
}
}
impl Add<i32> for &Integer {
type Output = Integer;
fn add(self, rhs: i32) -> Self::Output {
Integer::add_c_long(self, rhs)
}
}
impl Add<&i32> for &Integer {
type Output = Integer;
fn add(self, rhs: &i32) -> Self::Output {
Integer::add_c_long(self, *rhs)
}
}
impl Add<Integer> for i32 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(self, &mut rhs);
rhs
}
}
impl Add<&Integer> for i32 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(self, rhs)
}
}
impl Add<Integer> for &i32 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(*self, &mut rhs);
rhs
}
}
impl Add<&Integer> for &i32 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(*self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<u32> for Integer {
type Output = Integer;
fn add(mut self, rhs: u32) -> Self::Output {
Integer::add_c_long_assign(&mut self, rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&u32> for Integer {
type Output = Integer;
fn add(mut self, rhs: &u32) -> Self::Output {
Integer::add_c_long_assign(&mut self, *rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<u32> for &Integer {
type Output = Integer;
fn add(self, rhs: u32) -> Self::Output {
Integer::add_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&u32> for &Integer {
type Output = Integer;
fn add(self, rhs: &u32) -> Self::Output {
Integer::add_c_long(self, *rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<Integer> for u32 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&Integer> for u32 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<Integer> for &u32 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(*self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&Integer> for &u32 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(*self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<i64> for Integer {
type Output = Integer;
fn add(mut self, rhs: i64) -> Self::Output {
Integer::add_c_long_assign(&mut self, rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&i64> for Integer {
type Output = Integer;
fn add(mut self, rhs: &i64) -> Self::Output {
Integer::add_c_long_assign(&mut self, *rhs);
self
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<i64> for &Integer {
type Output = Integer;
fn add(self, rhs: i64) -> Self::Output {
Integer::add_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&i64> for &Integer {
type Output = Integer;
fn add(self, rhs: &i64) -> Self::Output {
Integer::add_c_long(self, *rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<Integer> for i64 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&Integer> for i64 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(self, rhs)
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<Integer> for &i64 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_c_long_assign(*self, &mut rhs);
rhs
}
}
#[cfg(all(target_pointer_width = "64", not(windows)))]
impl Add<&Integer> for &i64 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
reverse_add_c_long(*self, rhs)
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<u32> for Integer {
type Output = Integer;
fn add(mut self, rhs: u32) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&u32> for Integer {
type Output = Integer;
fn add(mut self, rhs: &u32) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(*rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<u32> for &Integer {
type Output = Integer;
fn add(self, rhs: u32) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&u32> for &Integer {
type Output = Integer;
fn add(self, rhs: &u32) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<Integer> for u32 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&Integer> for u32 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<Integer> for &u32 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&Integer> for &u32 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<i64> for Integer {
type Output = Integer;
fn add(mut self, rhs: i64) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&i64> for Integer {
type Output = Integer;
fn add(mut self, rhs: &i64) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(*rhs));
self
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<i64> for &Integer {
type Output = Integer;
fn add(self, rhs: i64) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&i64> for &Integer {
type Output = Integer;
fn add(self, rhs: &i64) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<Integer> for i64 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&Integer> for i64 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<Integer> for &i64 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
#[cfg(not(all(target_pointer_width = "64", not(windows))))]
impl Add<&Integer> for &i64 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
impl Add<u64> for Integer {
type Output = Integer;
fn add(mut self, rhs: u64) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(rhs));
self
}
}
impl Add<&u64> for Integer {
type Output = Integer;
fn add(mut self, rhs: &u64) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(*rhs));
self
}
}
impl Add<u64> for &Integer {
type Output = Integer;
fn add(self, rhs: u64) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
impl Add<&u64> for &Integer {
type Output = Integer;
fn add(self, rhs: &u64) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
impl Add<Integer> for u64 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(self), &mut rhs);
rhs
}
}
impl Add<&Integer> for u64 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
impl Add<Integer> for &u64 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
impl Add<&Integer> for &u64 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
impl Add<i128> for Integer {
type Output = Integer;
fn add(mut self, rhs: i128) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(rhs));
self
}
}
impl Add<&i128> for Integer {
type Output = Integer;
fn add(mut self, rhs: &i128) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(*rhs));
self
}
}
impl Add<i128> for &Integer {
type Output = Integer;
fn add(self, rhs: i128) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
impl Add<&i128> for &Integer {
type Output = Integer;
fn add(self, rhs: &i128) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
impl Add<Integer> for i128 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(self), &mut rhs);
rhs
}
}
impl Add<&Integer> for i128 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
impl Add<Integer> for &i128 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
impl Add<&Integer> for &i128 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
impl Add<u128> for Integer {
type Output = Integer;
fn add(mut self, rhs: u128) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(rhs));
self
}
}
impl Add<&u128> for Integer {
type Output = Integer;
fn add(mut self, rhs: &u128) -> Self::Output {
Integer::add_assign(&mut self, &Integer::from(*rhs));
self
}
}
impl Add<u128> for &Integer {
type Output = Integer;
fn add(self, rhs: u128) -> Self::Output {
let mut rhs = Integer::from(rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
impl Add<&u128> for &Integer {
type Output = Integer;
fn add(self, rhs: &u128) -> Self::Output {
let mut rhs = Integer::from(*rhs);
reverse_add_assign(self, &mut rhs);
rhs
}
}
impl Add<Integer> for u128 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(self), &mut rhs);
rhs
}
}
impl Add<&Integer> for u128 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}
impl Add<Integer> for &u128 {
type Output = Integer;
fn add(self, mut rhs: Integer) -> Self::Output {
reverse_add_assign(&Integer::from(*self), &mut rhs);
rhs
}
}
impl Add<&Integer> for &u128 {
type Output = Integer;
fn add(self, rhs: &Integer) -> Self::Output {
let mut lhs = Integer::from(*self);
Integer::add_assign(&mut lhs, rhs);
lhs
}
}