diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-06 17:41:03 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-10-09 09:44:51 -0700 |
| commit | 1bfe450a5ed0396c23185fc739d77ac9f79efe15 (patch) | |
| tree | ca0d94ca751c4db828653ed064da60ae8fc17969 | |
| parent | 831f909484176c20a6acba0a689cb9787948e9d7 (diff) | |
| download | rust-1bfe450a5ed0396c23185fc739d77ac9f79efe15.tar.gz rust-1bfe450a5ed0396c23185fc739d77ac9f79efe15.zip | |
num: Convert statics to constants
| -rw-r--r-- | src/libnum/bigint.rs | 6 | ||||
| -rw-r--r-- | src/libnum/complex.rs | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index af2ff747fe9..e52d62a040b 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -77,7 +77,7 @@ pub type BigDigit = u32; /// size is the double of the size of `BigDigit`. pub type DoubleBigDigit = u64; -pub static ZERO_BIG_DIGIT: BigDigit = 0; +pub const ZERO_BIG_DIGIT: BigDigit = 0; static ZERO_VEC: [BigDigit, ..1] = [ZERO_BIG_DIGIT]; #[allow(non_snake_case)] @@ -87,10 +87,10 @@ pub mod BigDigit { // `DoubleBigDigit` size dependent #[allow(non_uppercase_statics)] - pub static bits: uint = 32; + pub const bits: uint = 32; #[allow(non_uppercase_statics)] - pub static base: DoubleBigDigit = 1 << bits; + pub const base: DoubleBigDigit = 1 << bits; #[allow(non_uppercase_statics)] static lo_mask: DoubleBigDigit = (-1 as DoubleBigDigit) >> bits; diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs index 0e70527cdca..6690b1d5ddc 100644 --- a/src/libnum/complex.rs +++ b/src/libnum/complex.rs @@ -194,13 +194,13 @@ mod test { use std::num::{Zero, One, Float}; use std::hash::hash; - pub static _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 }; - pub static _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 }; - pub static _1_1i : Complex64 = Complex { re: 1.0, im: 1.0 }; - pub static _0_1i : Complex64 = Complex { re: 0.0, im: 1.0 }; - pub static _neg1_1i : Complex64 = Complex { re: -1.0, im: 1.0 }; - pub static _05_05i : Complex64 = Complex { re: 0.5, im: 0.5 }; - pub static all_consts : [Complex64, .. 5] = [_0_0i, _1_0i, _1_1i, _neg1_1i, _05_05i]; + pub const _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 }; + pub const _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 }; + pub const _1_1i : Complex64 = Complex { re: 1.0, im: 1.0 }; + pub const _0_1i : Complex64 = Complex { re: 0.0, im: 1.0 }; + pub const _neg1_1i : Complex64 = Complex { re: -1.0, im: 1.0 }; + pub const _05_05i : Complex64 = Complex { re: 0.5, im: 0.5 }; + pub const all_consts : [Complex64, .. 5] = [_0_0i, _1_0i, _1_1i, _neg1_1i, _05_05i]; #[test] fn test_consts() { |
