diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-08-30 12:54:50 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-08-31 16:21:47 -0700 |
| commit | 4128cc4cb44acb415be3cfdfa008fd6c95ceee74 (patch) | |
| tree | 321c8c7ed1c28247377bf4122365c047d69f891f /src/libcore/uint-template.rs | |
| parent | 638db28c472c1edadc3c37f900df28f14cca7665 (diff) | |
Make utility funs in core::int, core::uint, etc. not by-reference
Closes #3302
Diffstat (limited to 'src/libcore/uint-template.rs')
| -rw-r--r-- | src/libcore/uint-template.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 5119a5dd562..dfab2e36096 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -24,21 +24,21 @@ const bytes : uint = (inst::bits / 8); const min_value: T = 0 as T; const max_value: T = 0 as T - 1 as T; -pure fn min(x: &T, y: &T) -> T { if *x < *y { *x } else { *y } } -pure fn max(x: &T, y: &T) -> T { if *x > *y { *x } else { *y } } - -pure fn add(x: &T, y: &T) -> T { *x + *y } -pure fn sub(x: &T, y: &T) -> T { *x - *y } -pure fn mul(x: &T, y: &T) -> T { *x * *y } -pure fn div(x: &T, y: &T) -> T { *x / *y } -pure fn rem(x: &T, y: &T) -> T { *x % *y } - -pure fn lt(x: &T, y: &T) -> bool { *x < *y } -pure fn le(x: &T, y: &T) -> bool { *x <= *y } -pure fn eq(x: &T, y: &T) -> bool { *x == *y } -pure fn ne(x: &T, y: &T) -> bool { *x != *y } -pure fn ge(x: &T, y: &T) -> bool { *x >= *y } -pure fn gt(x: &T, y: &T) -> bool { *x > *y } +pure fn min(x: T, y: T) -> T { if x < y { x } else { y } } +pure fn max(x: T, y: T) -> T { if x > y { x } else { y } } + +pure fn add(x: T, y: T) -> T { x + y } +pure fn sub(x: T, y: T) -> T { x - y } +pure fn mul(x: T, y: T) -> T { x * y } +pure fn div(x: T, y: T) -> T { x / y } +pure fn rem(x: T, y: T) -> T { x % y } + +pure fn lt(x: T, y: T) -> bool { x < y } +pure fn le(x: T, y: T) -> bool { x <= y } +pure fn eq(x: T, y: T) -> bool { x == y } +pure fn ne(x: T, y: T) -> bool { x != y } +pure fn ge(x: T, y: T) -> bool { x >= y } +pure fn gt(x: T, y: T) -> bool { x > y } pure fn is_positive(x: T) -> bool { x > 0 as T } pure fn is_negative(x: T) -> bool { x < 0 as T } |
