num: Convert statics to constants

This commit is contained in:
Alex Crichton 2014-10-06 17:41:03 -07:00
parent 831f909484
commit 1bfe450a5e
2 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -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() {