Skip to content

Commit 1bfe450

Browse files
committed
num: Convert statics to constants
1 parent 831f909 commit 1bfe450

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/libnum/bigint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub type BigDigit = u32;
7777
/// size is the double of the size of `BigDigit`.
7878
pub type DoubleBigDigit = u64;
7979

80-
pub static ZERO_BIG_DIGIT: BigDigit = 0;
80+
pub const ZERO_BIG_DIGIT: BigDigit = 0;
8181
static ZERO_VEC: [BigDigit, ..1] = [ZERO_BIG_DIGIT];
8282

8383
#[allow(non_snake_case)]
@@ -87,10 +87,10 @@ pub mod BigDigit {
8787

8888
// `DoubleBigDigit` size dependent
8989
#[allow(non_uppercase_statics)]
90-
pub static bits: uint = 32;
90+
pub const bits: uint = 32;
9191

9292
#[allow(non_uppercase_statics)]
93-
pub static base: DoubleBigDigit = 1 << bits;
93+
pub const base: DoubleBigDigit = 1 << bits;
9494
#[allow(non_uppercase_statics)]
9595
static lo_mask: DoubleBigDigit = (-1 as DoubleBigDigit) >> bits;
9696

src/libnum/complex.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,13 @@ mod test {
194194
use std::num::{Zero, One, Float};
195195
use std::hash::hash;
196196

197-
pub static _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 };
198-
pub static _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 };
199-
pub static _1_1i : Complex64 = Complex { re: 1.0, im: 1.0 };
200-
pub static _0_1i : Complex64 = Complex { re: 0.0, im: 1.0 };
201-
pub static _neg1_1i : Complex64 = Complex { re: -1.0, im: 1.0 };
202-
pub static _05_05i : Complex64 = Complex { re: 0.5, im: 0.5 };
203-
pub static all_consts : [Complex64, .. 5] = [_0_0i, _1_0i, _1_1i, _neg1_1i, _05_05i];
197+
pub const _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 };
198+
pub const _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 };
199+
pub const _1_1i : Complex64 = Complex { re: 1.0, im: 1.0 };
200+
pub const _0_1i : Complex64 = Complex { re: 0.0, im: 1.0 };
201+
pub const _neg1_1i : Complex64 = Complex { re: -1.0, im: 1.0 };
202+
pub const _05_05i : Complex64 = Complex { re: 0.5, im: 0.5 };
203+
pub const all_consts : [Complex64, .. 5] = [_0_0i, _1_0i, _1_1i, _neg1_1i, _05_05i];
204204

205205
#[test]
206206
fn test_consts() {

0 commit comments

Comments
 (0)