Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Fixed break_if_last! and incre_or_break_if_last! macros
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Apr 5, 2019
1 parent 812cb04 commit 6b7eeec
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/misc_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,6 @@ macro_rules! shadow_to_avoid_use {
}

macro_rules! break_if_last {
(
$cur:expr, $last:expr
) => {{
if $cur == $last {
break;
}
}};
(
seq_num => $cur:expr
) => {{
Expand All @@ -485,15 +478,16 @@ macro_rules! break_if_last {
) => {{
break_if_last!($cur, std::u64::MAX);
}};
}

macro_rules! incre_or_break_if_last {
(
$cur:expr, $last:expr
) => {{
break_if_last!($cur, $last);
$cur += 1;
if $cur == $last {
break;
}
}};
}

macro_rules! incre_or_break_if_last {
(
seq_num => $cur:expr
) => {
Expand All @@ -506,4 +500,10 @@ macro_rules! incre_or_break_if_last {
break_if_last!(block_index => $cur);
$cur += 1;
};
(
$cur:expr, $last:expr
) => {{
break_if_last!($cur, $last);
$cur += 1;
}};
}

0 comments on commit 6b7eeec

Please sign in to comment.