Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BRAMAS Berenger
spetabaru
Commits
f92f1958
Commit
f92f1958
authored
Sep 09, 2020
by
CARDOSI Paul
Browse files
Add comment explaining counter increment.
parent
c94237d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Src/Random/SpPhiloxGenerator.hpp
View file @
f92f1958
...
...
@@ -66,7 +66,15 @@ class SpPhiloxGenerator {
count
-=
nbStepsToNextMultipleOf4
;
// We need to add 1 to the counter because we have moved past
// all the 4 results from the current temp_results_ array. This
// also includes the special case where we already are on the edge
// (temp_counter_ == 4) but we haven't triggered a counter increment yet.
// We can safely add 1 here (instead of calling SkipOne). I won't cause any
// overfow since we are dividing the value of count by 4 and count has a
// width of 64 bits.
const
auto
nbOfCounterIncrements
=
count
/
4
+
1
;
temp_counter_
=
count
%
4
;
const
auto
count_lo
=
static_cast
<
uint32
>
(
nbOfCounterIncrements
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment