about summary refs log tree commit diff
path: root/src/libextra/num
diff options
context:
space:
mode:
authorChris Wong <lambda.fairy@gmail.com>2014-01-25 20:37:51 +1300
committerChris Wong <lambda.fairy@gmail.com>2014-01-25 21:38:25 +1300
commit988e4f0a1c2802921375271bdc19f03650c024d2 (patch)
treeb2d2913ca7575e8e52f2cf6e7975ca2f0f148286 /src/libextra/num
parentde57a22b9a8c8416cace31c9bd3ec4c9a6888017 (diff)
downloadrust-988e4f0a1c2802921375271bdc19f03650c024d2.tar.gz
rust-988e4f0a1c2802921375271bdc19f03650c024d2.zip
Uppercase numeric constants
The following are renamed:

* `min_value` => `MIN`
* `max_value` => `MAX`
* `bits` => `BITS`
* `bytes` => `BYTES`

Fixes #10010.
Diffstat (limited to 'src/libextra/num')
-rw-r--r--src/libextra/num/bigint.rs42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs
index 8729cf1b685..1e1c09431b6 100644
--- a/src/libextra/num/bigint.rs
+++ b/src/libextra/num/bigint.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -1186,7 +1186,7 @@ impl ToPrimitive for BigInt {
                     if n < m {
                         Some(-(n as i64))
                     } else if n == m {
-                        Some(i64::min_value)
+                        Some(i64::MIN)
                     } else {
                         None
                     }
@@ -1213,7 +1213,7 @@ impl FromPrimitive for BigInt {
                 Some(BigInt::from_biguint(Plus, n))
             })
         } else if n < 0 {
-            FromPrimitive::from_u64(u64::max_value - (n as u64) + 1).and_then(
+            FromPrimitive::from_u64(u64::MAX - (n as u64) + 1).and_then(
                 |n| {
                     Some(BigInt::from_biguint(Minus, n))
                 })
@@ -1625,7 +1625,7 @@ mod biguint_tests {
 
         check(Zero::zero(), 0);
         check(One::one(), 1);
-        check(i64::max_value.to_biguint().unwrap(), i64::max_value);
+        check(i64::MAX.to_biguint().unwrap(), i64::MAX);
 
         check(BigUint::new(~[                   ]), 0);
         check(BigUint::new(~[ 1                 ]), (1 << (0*BigDigit::bits)));
@@ -1635,9 +1635,9 @@ mod biguint_tests {
         check(BigUint::new(~[ 0,  0,  1         ]), (1 << (2*BigDigit::bits)));
         check(BigUint::new(~[-1, -1, -1         ]), (1 << (3*BigDigit::bits)) - 1);
         check(BigUint::new(~[ 0,  0,  0,  1     ]), (1 << (3*BigDigit::bits)));
-        check(BigUint::new(~[-1, -1, -1, -1 >> 1]), i64::max_value);
+        check(BigUint::new(~[-1, -1, -1, -1 >> 1]), i64::MAX);
 
-        assert_eq!(i64::min_value.to_biguint(), None);
+        assert_eq!(i64::MIN.to_biguint(), None);
         assert_eq!(BigUint::new(~[-1, -1, -1, -1    ]).to_i64(), None);
         assert_eq!(BigUint::new(~[ 0,  0,  0,  0,  1]).to_i64(), None);
         assert_eq!(BigUint::new(~[-1, -1, -1, -1, -1]).to_i64(), None);
@@ -1654,15 +1654,15 @@ mod biguint_tests {
 
         check(Zero::zero(), 0);
         check(One::one(), 1);
-        check(i64::max_value.to_biguint().unwrap(), i64::max_value);
+        check(i64::MAX.to_biguint().unwrap(), i64::MAX);
 
         check(BigUint::new(~[           ]), 0);
         check(BigUint::new(~[ 1         ]), (1 << (0*BigDigit::bits)));
         check(BigUint::new(~[-1         ]), (1 << (1*BigDigit::bits)) - 1);
         check(BigUint::new(~[ 0,  1     ]), (1 << (1*BigDigit::bits)));
-        check(BigUint::new(~[-1, -1 >> 1]), i64::max_value);
+        check(BigUint::new(~[-1, -1 >> 1]), i64::MAX);
 
-        assert_eq!(i64::min_value.to_biguint(), None);
+        assert_eq!(i64::MIN.to_biguint(), None);
         assert_eq!(BigUint::new(~[-1, -1    ]).to_i64(), None);
         assert_eq!(BigUint::new(~[ 0,  0,  1]).to_i64(), None);
         assert_eq!(BigUint::new(~[-1, -1, -1]).to_i64(), None);
@@ -1679,8 +1679,8 @@ mod biguint_tests {
 
         check(Zero::zero(), 0);
         check(One::one(), 1);
-        check(u64::min_value.to_biguint().unwrap(), u64::min_value);
-        check(u64::max_value.to_biguint().unwrap(), u64::max_value);
+        check(u64::MIN.to_biguint().unwrap(), u64::MIN);
+        check(u64::MAX.to_biguint().unwrap(), u64::MAX);
 
         check(BigUint::new(~[              ]), 0);
         check(BigUint::new(~[ 1            ]), (1 << (0*BigDigit::bits)));
@@ -1690,7 +1690,7 @@ mod biguint_tests {
         check(BigUint::new(~[ 0,  0,  1    ]), (1 << (2*BigDigit::bits)));
         check(BigUint::new(~[-1, -1, -1    ]), (1 << (3*BigDigit::bits)) - 1);
         check(BigUint::new(~[ 0,  0,  0,  1]), (1 << (3*BigDigit::bits)));
-        check(BigUint::new(~[-1, -1, -1, -1]), u64::max_value);
+        check(BigUint::new(~[-1, -1, -1, -1]), u64::MAX);
 
         assert_eq!(BigUint::new(~[ 0,  0,  0,  0,  1]).to_u64(), None);
         assert_eq!(BigUint::new(~[-1, -1, -1, -1, -1]).to_u64(), None);
@@ -1707,14 +1707,14 @@ mod biguint_tests {
 
         check(Zero::zero(), 0);
         check(One::one(), 1);
-        check(u64::min_value.to_biguint().unwrap(), u64::min_value);
-        check(u64::max_value.to_biguint().unwrap(), u64::max_value);
+        check(u64::MIN.to_biguint().unwrap(), u64::MIN);
+        check(u64::MAX.to_biguint().unwrap(), u64::MAX);
 
         check(BigUint::new(~[      ]), 0);
         check(BigUint::new(~[ 1    ]), (1 << (0*BigDigit::bits)));
         check(BigUint::new(~[-1    ]), (1 << (1*BigDigit::bits)) - 1);
         check(BigUint::new(~[ 0,  1]), (1 << (1*BigDigit::bits)));
-        check(BigUint::new(~[-1, -1]), u64::max_value);
+        check(BigUint::new(~[-1, -1]), u64::MAX);
 
         assert_eq!(BigUint::new(~[ 0,  0,  1]).to_u64(), None);
         assert_eq!(BigUint::new(~[-1, -1, -1]).to_u64(), None);
@@ -2166,11 +2166,11 @@ mod bigint_tests {
 
         check(Zero::zero(), 0);
         check(One::one(), 1);
-        check(i64::min_value.to_bigint().unwrap(), i64::min_value);
-        check(i64::max_value.to_bigint().unwrap(), i64::max_value);
+        check(i64::MIN.to_bigint().unwrap(), i64::MIN);
+        check(i64::MAX.to_bigint().unwrap(), i64::MAX);
 
         assert_eq!(
-            (i64::max_value as u64 + 1).to_bigint().unwrap().to_i64(),
+            (i64::MAX as u64 + 1).to_bigint().unwrap().to_i64(),
             None);
 
         assert_eq!(
@@ -2196,14 +2196,14 @@ mod bigint_tests {
 
         check(Zero::zero(), 0);
         check(One::one(), 1);
-        check(u64::min_value.to_bigint().unwrap(), u64::min_value);
-        check(u64::max_value.to_bigint().unwrap(), u64::max_value);
+        check(u64::MIN.to_bigint().unwrap(), u64::MIN);
+        check(u64::MAX.to_bigint().unwrap(), u64::MAX);
 
         assert_eq!(
             BigInt::from_biguint(Plus, BigUint::new(~[1, 2, 3, 4, 5])).to_u64(),
             None);
 
-        let max_value: BigUint = FromPrimitive::from_u64(u64::max_value).unwrap();
+        let max_value: BigUint = FromPrimitive::from_u64(u64::MAX).unwrap();
         assert_eq!(BigInt::from_biguint(Minus, max_value).to_u64(), None);
         assert_eq!(BigInt::from_biguint(Minus, BigUint::new(~[1, 2, 3, 4, 5])).to_u64(), None);
     }