Skip to content

Commit

Permalink
Fix macro expansion in Counting # Bit twiddling
Browse files Browse the repository at this point in the history
  • Loading branch information
guilliamxavier authored and Veykril committed Sep 6, 2023
1 parent 99a3c3b commit acd3623
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/decl-macros/building-blocks/counting.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ count_tts!(0 0 0 0 0) << 1;
```
This invocation will now match the second rule as its input is an uneven amount of token trees.
In this case the first token tree is discarded to make the input even again, then we also do the halving step in this invocation again since we know the input would be even now anyways.
Therefor we can count 1 for the uneven discard and multiply by 2 again since we also halved.
Therefore we can count 1 for the uneven discard and multiply by 2 again since we also halved.
```rust,ignore
((count_tts!(0 0) << 1) | 1) << 1;
```
```rust,ignore
((count_tts!(0) << 1 << 1) | 1) << 1;
```
```rust,ignore
(((count_tts!() | 1) << 1 << 1) | 1) << 1;
((((count_tts!() << 1) | 1) << 1 << 1) | 1) << 1;
```
```rust,ignore
((((0 << 1) | 1) << 1 << 1) | 1) << 1;
Expand Down

0 comments on commit acd3623

Please sign in to comment.