rust/fpnum/src/lib.rs
changeset 14140 3078123e84ea
parent 14139 37c99587825d
child 14178 a4c17cfaa4c9
equal deleted inserted replaced
14139:37c99587825d 14140:3078123e84ea
   453             fn $name(self, rhs: FPNum) -> Self {
   453             fn $name(self, rhs: FPNum) -> Self {
   454                 Self::new(self.x().$name(rhs),
   454                 Self::new(self.x().$name(rhs),
   455                           self.y().$name(rhs))
   455                           self.y().$name(rhs))
   456             }
   456             }
   457         }
   457         }
       
   458     };
       
   459     ($($op: tt)::+<$arg: tt>, $name: tt) => {
       
   460         impl $($op)::+<$arg> for FPPoint {
       
   461             type Output = Self;
       
   462 
       
   463             #[inline]
       
   464             fn $name(self, rhs: $arg) -> Self {
       
   465                 Self::new(self.x().$name(rhs),
       
   466                           self.y().$name(rhs))
       
   467             }
       
   468         }
   458     }
   469     }
   459 }
   470 }
   460 
   471 
   461 macro_rules! left_scalar_bin_op_impl {
   472 macro_rules! left_scalar_bin_op_impl {
   462     ($($op: tt)::+, $name: tt) => {
   473     ($($op: tt)::+, $name: tt) => {
   478 bin_op_impl!(ops::Div, div);
   489 bin_op_impl!(ops::Div, div);
   479 right_scalar_bin_op_impl!(ops::Add, add);
   490 right_scalar_bin_op_impl!(ops::Add, add);
   480 right_scalar_bin_op_impl!(ops::Mul, mul);
   491 right_scalar_bin_op_impl!(ops::Mul, mul);
   481 right_scalar_bin_op_impl!(ops::Sub, sub);
   492 right_scalar_bin_op_impl!(ops::Sub, sub);
   482 right_scalar_bin_op_impl!(ops::Div, div);
   493 right_scalar_bin_op_impl!(ops::Div, div);
       
   494 right_scalar_bin_op_impl!(ops::Div<u32>, div);
   483 left_scalar_bin_op_impl!(ops::Mul, mul);
   495 left_scalar_bin_op_impl!(ops::Mul, mul);
   484 
   496 
   485 macro_rules! bin_assign_op_impl {
   497 macro_rules! bin_assign_op_impl {
   486     ($typ: tt, $($op: tt)::+, $name: tt, $delegate: tt) => {
   498     ($typ: tt, $($op: tt)::+, $name: tt, $delegate: tt) => {
   487         bin_assign_op_impl!($typ, $($op)::+<$typ>, $name, $delegate);
   499         bin_assign_op_impl!($typ, $($op)::+<$typ>, $name, $delegate);