From 9c03ef1ccb1243790ec49bff682f8590f7c997ae Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Mon, 5 Nov 2012 00:35:52 +1000 Subject: [PATCH] Formatting --- src/common/math.rs | 75 ++++++---------------------------------------- 1 file changed, 9 insertions(+), 66 deletions(-) diff --git a/src/common/math.rs b/src/common/math.rs index cdb7c33..9d88c9e 100644 --- a/src/common/math.rs +++ b/src/common/math.rs @@ -100,74 +100,18 @@ trait Abs { } #[inline(always)] -pure fn abs(x: &T) -> T { +pure fn abs(x: &T) -> T { x.abs() } -impl i8: Abs { - #[inline(always)] - pure fn abs() -> i8 { - if self >= 0 { self } - else {-self } - } -} - -impl i16: Abs { - #[inline(always)] - pure fn abs() -> i16 { - if self >= 0 { self } - else {-self } - } -} - -impl i32: Abs { - #[inline(always)] - pure fn abs() -> i32 { - if self >= 0 { self } - else {-self } - } -} - -impl i64: Abs { - #[inline(always)] - pure fn abs() -> i64 { - if self >= 0 { self } - else {-self } - } -} - -impl int: Abs { - #[inline(always)] - pure fn abs() -> int { - if self >= 0 { self } - else {-self } - } -} - -impl f32: Abs { - #[inline(always)] - pure fn abs() -> f32 { - if self >= 0f32 { self } - else {-self } - } -} - -impl f64: Abs { - #[inline(always)] - pure fn abs() -> f64 { - if self >= 0f64 { self } - else {-self } - } -} - -impl float: Abs { - #[inline(always)] - pure fn abs() -> float { - if self >= 0f { self } - else {-self } - } -} - +impl i8: Abs { #[inline(always)] pure fn abs() -> i8 { if self >= 0 { self } else {-self } } } +impl i16: Abs { #[inline(always)] pure fn abs() -> i16 { if self >= 0 { self } else {-self } } } +impl i32: Abs { #[inline(always)] pure fn abs() -> i32 { if self >= 0 { self } else {-self } } } +impl i64: Abs { #[inline(always)] pure fn abs() -> i64 { if self >= 0 { self } else {-self } } } +impl int: Abs { #[inline(always)] pure fn abs() -> int { if self >= 0 { self } else {-self } } } +impl f32: Abs { #[inline(always)] pure fn abs() -> f32 { if self >= 0f32 { self } else {-self } } } +impl f64: Abs { #[inline(always)] pure fn abs() -> f64 { if self >= 0f64 { self } else {-self } } } +impl float: Abs { #[inline(always)] pure fn abs() -> float { if self >= 0f { self } else {-self } } } pub trait Sqrt { pure fn sqrt() -> self; @@ -223,7 +167,6 @@ pub impl T: Trig { #[inline(always)] pure fn atan2(n: T) -> T { f64::atan2(self.cast(), move n.cast()).cast() } } - pub trait AngleUnits { pure fn to_radians() -> self; pure fn to_degrees() -> self;