diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2016-04-30 03:40:34 +0300 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2016-04-30 03:40:34 +0300 |
| commit | 04f8ba2ece3de0892e826db86f491f044e06d24c (patch) | |
| tree | 31692235d598ac7500f41aa513fbf068d7390a72 | |
| parent | 5f956103c8a939e69b1da6f9b8f674802520b229 (diff) | |
| download | rust-04f8ba2ece3de0892e826db86f491f044e06d24c.tar.gz rust-04f8ba2ece3de0892e826db86f491f044e06d24c.zip | |
Impl int/uint::MIN/MAX in terms of min/max_value
| -rw-r--r-- | src/libcore/num/int_macros.rs | 13 | ||||
| -rw-r--r-- | src/libcore/num/uint_macros.rs | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 42349257ab7..fb1a3bbe3b4 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -10,6 +10,7 @@ #![doc(hidden)] +#[cfg(stage0)] macro_rules! int_module { ($T:ty, $bits:expr) => ( // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of @@ -25,3 +26,15 @@ pub const MIN: $T = (-1 as $T) << ($bits - 1); pub const MAX: $T = !MIN; ) } + +#[cfg(not(stage0))] +macro_rules! int_module { ($T:ident, $bits:expr) => ( + +#[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] +pub const MIN: $T = $T::min_value(); +#[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] +pub const MAX: $T = $T::max_value(); + +) } diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 6479836cbe1..af6b1b89f96 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -10,6 +10,7 @@ #![doc(hidden)] +#[cfg(stage0)] macro_rules! uint_module { ($T:ty, $bits:expr) => ( #[stable(feature = "rust1", since = "1.0.0")] @@ -20,3 +21,15 @@ pub const MIN: $T = 0 as $T; pub const MAX: $T = !0 as $T; ) } + +#[cfg(not(stage0))] +macro_rules! uint_module { ($T:ident, $bits:expr) => ( + +#[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] +pub const MIN: $T = $T::min_value(); +#[stable(feature = "rust1", since = "1.0.0")] +#[allow(missing_docs)] +pub const MAX: $T = $T::max_value(); + +) } |
