Skip to content

Commit

Permalink
Rollup merge of #108279 - Nilstrieb:int, r=scottmcm
Browse files Browse the repository at this point in the history
Use named arguments for `{,u}int_impls` macro

This makes it way easier to understand.

r? `@scottmcm`
  • Loading branch information
matthiaskrgr authored Feb 20, 2023
2 parents ea7ca70 + eb5d82b commit 4f532da
Show file tree
Hide file tree
Showing 3 changed files with 356 additions and 78 deletions.
25 changes: 20 additions & 5 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
macro_rules! int_impl {
($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,
$bound_condition:expr) => {
(
Self = $SelfT:ty,
ActualT = $ActualT:ident,
UnsignedT = $UnsignedT:ty,
BITS = $BITS:expr,
BITS_MINUS_ONE = $BITS_MINUS_ONE:expr,
Min = $Min:expr,
Max = $Max:expr,
rot = $rot:expr,
rot_op = $rot_op:expr,
rot_result = $rot_result:expr,
swap_op = $swap_op:expr,
swapped = $swapped:expr,
reversed = $reversed:expr,
le_bytes = $le_bytes:expr,
be_bytes = $be_bytes:expr,
to_xe_bytes_doc = $to_xe_bytes_doc:expr,
from_xe_bytes_doc = $from_xe_bytes_doc:expr,
bound_condition = $bound_condition:expr,
) => {
/// The smallest value that can be represented by this integer type
#[doc = concat!("(&minus;2<sup>", $BITS_MINUS_ONE, "</sup>", $bound_condition, ").")]
///
Expand Down
Loading

0 comments on commit 4f532da

Please sign in to comment.