Skip to content

Commit 90a3460

Browse files
authored
qualify std uint
1 parent 8998844 commit 90a3460

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

math/mathcore/inc/Math/LFSR.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ namespace ROOT::Math::LFSR {
5454
* https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence
5555
*/
5656
template <size_t k, size_t nTaps>
57-
bool NextLFSR(std::bitset<k> &lfsr, std::array<uint16_t, nTaps> taps, bool left = true)
57+
bool NextLFSR(std::bitset<k> &lfsr, std::array<std::uint16_t, nTaps> taps, bool left = true)
5858
{
5959
static_assert(k <= 32, "For the moment, only supported until k == 32.");
6060
static_assert(k > 0, "Non-zero degree is needed for the LFSR.");
6161
static_assert(nTaps > 0, "At least one tap is needed for the LFSR.");
6262
static_assert(nTaps <= k, "Cannot use more taps than polynomial order");
63-
for (uint16_t j = 0; j < nTaps; ++j) {
63+
for (std::uint16_t j = 0; j < nTaps; ++j) {
6464
assert(static_cast<size_t>(taps[j] - 1) <= k && static_cast<size_t>(taps[j] - 1) > 0 &&
6565
"Tap value is out of range [1,k]");
6666
}
6767

6868
// First, calculate the XOR (^) of all selected bits (marked by the taps)
6969
bool newBit = lfsr[taps[0] - 1]; // the exponent E of the polynomial correspond to index E - 1 in the bitset
70-
for (uint16_t j = 1; j < nTaps; ++j) {
70+
for (std::uint16_t j = 1; j < nTaps; ++j) {
7171
newBit ^= lfsr[taps[j] - 1];
7272
}
7373

@@ -104,7 +104,7 @@ bool NextLFSR(std::bitset<k> &lfsr, std::array<uint16_t, nTaps> taps, bool left
104104
* https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence
105105
*/
106106
template <size_t k, size_t nTaps, typename Output = unsigned char>
107-
std::vector<Output> GenerateSequence(std::bitset<k> start, std::array<uint16_t, nTaps> taps, bool left = true,
107+
std::vector<Output> GenerateSequence(std::bitset<k> start, std::array<std::uint16_t, nTaps> taps, bool left = true,
108108
bool wrapping = false, bool oppositeBit = false)
109109
{
110110
std::vector<Output> result; // Store result here
@@ -126,12 +126,12 @@ std::vector<Output> GenerateSequence(std::bitset<k> start, std::array<uint16_t,
126126
}
127127

128128
// Calculate maximum period and pre-allocate space in result
129-
const uint32_t maxPeriod = pow(2, k) - 1;
129+
const std::uint32_t maxPeriod = pow(2, k) - 1;
130130
result.reserve(maxPeriod);
131131

132132
std::set<uint32_t> lfsrHistory; // a placeholder to store the history of all different values of the LFSR
133133
std::bitset<k> lfsr(start); // a variable storing the current value of the LFSR
134-
uint32_t i = 0; // a loop counter
134+
std::uint32_t i = 0; // a loop counter
135135
if (oppositeBit) // if oppositeBit enabled, first value is already started with the seed
136136
result.emplace_back(left ? lfsr[k - 1] : lfsr[0]);
137137

0 commit comments

Comments
 (0)