Document math behind MIN/MAX consts on integers
This commit is contained in:
parent
bddb59cf07
commit
7abbc6e3c5
3 changed files with 15 additions and 12 deletions
|
@ -1,9 +1,10 @@
|
|||
macro_rules! int_impl {
|
||||
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr,
|
||||
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $BITS_MINUS_ONE:expr, $Min:expr, $Max:expr,
|
||||
$rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
|
||||
$reversed:expr, $le_bytes:expr, $be_bytes:expr,
|
||||
$to_xe_bytes_doc:expr, $from_xe_bytes_doc:expr) => {
|
||||
/// The smallest value that can be represented by this integer type.
|
||||
/// The smallest value that can be represented by this integer type,
|
||||
#[doc = concat!("-2<sup>", stringify!($BITS_MINUS_ONE), "</sup>.")]
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -15,7 +16,8 @@ macro_rules! int_impl {
|
|||
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
|
||||
pub const MIN: Self = !0 ^ ((!0 as $UnsignedT) >> 1) as Self;
|
||||
|
||||
/// The largest value that can be represented by this integer type.
|
||||
/// The largest value that can be represented by this integer type,
|
||||
#[doc = concat!("2<sup>", stringify!($BITS_MINUS_ONE), "</sup> - 1.")]
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue