Formatting

This commit is contained in:
Brendan Zabarauskas 2012-11-05 00:35:52 +10:00
parent 3dc5e26126
commit 9c03ef1ccb

View file

@ -100,74 +100,18 @@ trait Abs {
} }
#[inline(always)] #[inline(always)]
pure fn abs<T: Abs>(x: &T) -> T { pure fn abs<T:Abs>(x: &T) -> T {
x.abs() x.abs()
} }
impl i8: Abs { impl i8: Abs { #[inline(always)] pure fn abs() -> i8 { if self >= 0 { self } else {-self } } }
#[inline(always)] impl i16: Abs { #[inline(always)] pure fn abs() -> i16 { if self >= 0 { self } else {-self } } }
pure fn abs() -> i8 { impl i32: Abs { #[inline(always)] pure fn abs() -> i32 { if self >= 0 { self } else {-self } } }
if self >= 0 { self } impl i64: Abs { #[inline(always)] pure fn abs() -> i64 { if self >= 0 { self } else {-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 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 { pub trait Sqrt {
pure fn sqrt() -> self; pure fn sqrt() -> self;
@ -223,7 +167,6 @@ pub impl<T:NumCast> T: Trig {
#[inline(always)] pure fn atan2(n: T) -> T { f64::atan2(self.cast(), move n.cast()).cast() } #[inline(always)] pure fn atan2(n: T) -> T { f64::atan2(self.cast(), move n.cast()).cast() }
} }
pub trait AngleUnits { pub trait AngleUnits {
pure fn to_radians() -> self; pure fn to_radians() -> self;
pure fn to_degrees() -> self; pure fn to_degrees() -> self;