Removed module macro workaround for signed and unsigned integers
This commit is contained in:
parent
0d8ace823b
commit
4840064f85
@ -10,11 +10,17 @@
|
||||
|
||||
//! Operations and constants for `i16`
|
||||
|
||||
use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
|
||||
use option::{Option, Some, None};
|
||||
use unstable::intrinsics;
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
pub use self::generated::*;
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
int_module!(i16, 16)
|
||||
|
||||
|
@ -10,11 +10,17 @@
|
||||
|
||||
//! Operations and constants for `i32`
|
||||
|
||||
use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
|
||||
use option::{Option, Some, None};
|
||||
use unstable::intrinsics;
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
pub use self::generated::*;
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
int_module!(i32, 32)
|
||||
|
||||
|
@ -10,14 +10,20 @@
|
||||
|
||||
//! Operations and constants for `i64`
|
||||
|
||||
use num::{BitCount, CheckedAdd, CheckedSub};
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
#[cfg(target_word_size = "64")]
|
||||
use num::CheckedMul;
|
||||
use num::{BitCount, CheckedAdd, CheckedSub};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
pub use self::generated::*;
|
||||
|
||||
int_module!(i64, 64)
|
||||
|
||||
impl BitCount for i64 {
|
||||
|
@ -10,11 +10,17 @@
|
||||
|
||||
//! Operations and constants for `i8`
|
||||
|
||||
use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
|
||||
use option::{Option, Some, None};
|
||||
use unstable::intrinsics;
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
pub use self::generated::*;
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
int_module!(i8, 8)
|
||||
|
||||
|
@ -12,16 +12,18 @@
|
||||
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::{BitCount, CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
pub use self::generated::*;
|
||||
|
||||
#[cfg(target_word_size = "32")] pub static bits: uint = 32;
|
||||
#[cfg(target_word_size = "64")] pub static bits: uint = 64;
|
||||
|
||||
int_module!(int, super::bits)
|
||||
#[cfg(target_word_size = "32")] int_module!(int, 32)
|
||||
#[cfg(target_word_size = "64")] int_module!(int, 64)
|
||||
|
||||
#[cfg(target_word_size = "32")]
|
||||
impl BitCount for int {
|
||||
|
@ -8,22 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// FIXME(#4375): This shouldn't have to be a nested module named 'generated'...
|
||||
// FIXME(#10716): ... but now that we could solve that, the import lines and
|
||||
// attributes still prevent a removal of that module.
|
||||
|
||||
#[macro_escape];
|
||||
#[doc(hidden)];
|
||||
|
||||
macro_rules! int_module (($T:ty, $bits:expr) => (mod generated {
|
||||
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
use default::Default;
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use prelude::*;
|
||||
use str;
|
||||
macro_rules! int_module (($T:ty, $bits:expr) => (
|
||||
|
||||
pub static bits : uint = $bits;
|
||||
pub static bytes : uint = ($bits / 8);
|
||||
@ -781,4 +769,4 @@ fn test_signed_checked_div() {
|
||||
}
|
||||
}
|
||||
|
||||
}))
|
||||
))
|
||||
|
@ -10,11 +10,18 @@
|
||||
|
||||
//! Operations and constants for `u16`
|
||||
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use option::{Option, Some, None};
|
||||
use unstable::intrinsics;
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
pub use self::generated::*;
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::BitCount;
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
uint_module!(u16, i16, 16)
|
||||
|
||||
|
@ -10,11 +10,18 @@
|
||||
|
||||
//! Operations and constants for `u32`
|
||||
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use option::{Option, Some, None};
|
||||
use unstable::intrinsics;
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
pub use self::generated::*;
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::BitCount;
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
uint_module!(u32, i32, 32)
|
||||
|
||||
|
@ -10,14 +10,21 @@
|
||||
|
||||
//! Operations and constants for `u64`
|
||||
|
||||
use num::{CheckedAdd, CheckedSub};
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::BitCount;
|
||||
#[cfg(target_word_size = "64")]
|
||||
use num::CheckedMul;
|
||||
use num::{CheckedAdd, CheckedSub};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
pub use self::generated::*;
|
||||
|
||||
uint_module!(u64, i64, 64)
|
||||
|
||||
impl CheckedAdd for u64 {
|
||||
|
@ -10,11 +10,18 @@
|
||||
|
||||
//! Operations and constants for `u8`
|
||||
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use option::{Option, Some, None};
|
||||
use unstable::intrinsics;
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
pub use self::generated::*;
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use num::BitCount;
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
uint_module!(u8, i8, 8)
|
||||
|
||||
|
@ -10,13 +10,20 @@
|
||||
|
||||
//! Operations and constants for `uint`
|
||||
|
||||
use num;
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use option::{Option, Some, None};
|
||||
use unstable::intrinsics;
|
||||
use mem;
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
pub use self::generated::*;
|
||||
use prelude::*;
|
||||
|
||||
use default::Default;
|
||||
use mem;
|
||||
use num::BitCount;
|
||||
use num::{CheckedAdd, CheckedSub, CheckedMul};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use num;
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
uint_module!(uint, int, ::int::bits)
|
||||
|
||||
|
@ -8,23 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// FIXME(#4375): This shouldn't have to be a nested module named 'generated'...
|
||||
// FIXME(#10716): ... but now that we could solve that, the import lines and
|
||||
// attributes still prevent a removal of that module.
|
||||
|
||||
#[macro_escape];
|
||||
#[doc(hidden)];
|
||||
|
||||
macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (mod generated {
|
||||
|
||||
#[allow(non_uppercase_statics)];
|
||||
|
||||
use default::Default;
|
||||
use num::BitCount;
|
||||
use num::{ToStrRadix, FromStrRadix};
|
||||
use num::{CheckedDiv, Zero, One, strconv};
|
||||
use prelude::*;
|
||||
use str;
|
||||
macro_rules! uint_module (($T:ty, $T_SIGNED:ty, $bits:expr) => (
|
||||
|
||||
pub static bits : uint = $bits;
|
||||
pub static bytes : uint = ($bits / 8);
|
||||
@ -554,4 +541,4 @@ fn test_unsigned_checked_div() {
|
||||
}
|
||||
}
|
||||
|
||||
}))
|
||||
))
|
||||
|
Loading…
Reference in New Issue
Block a user