use core::ops::{Div, DivAssign};

use num_bigint::BigUint;

use super::Ex3Uint;

#[macro_export(local_inner_macros)]
macro_rules! impl_div_uint_for {
  ($for_type:ty, $($t:ty),*) => {
    $(
      impl Div<$t> for $for_type {
        type Output = $for_type;

        fn div(mut self, rhs: $t) -> Self::Output {
          self /= rhs;
          self
        }
      }
    )*
  };
}

#[macro_export(local_inner_macros)]
macro_rules! impl_div_assign_uint_for {
  ($for_type:ty, $($t:ty),*) => {
    $(
      impl DivAssign<$t> for $for_type {
        fn div_assign(&mut self, rhs: $t) {
          self.0 /= rhs;
        }
      }
    )*
  };
}

impl_div_uint_for!(Ex3Uint, u8, u16, u32, u64, u128, usize, BigUint);
impl_div_assign_uint_for!(Ex3Uint, u8, u16, u32, u64, u128, usize, BigUint);
