mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-21 17:16:44 +00:00
Increases const correctness, marks some additional constructors as constexpr, switches std::atomic construction style.
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ template <typename IntType, IntType reset_value, IntType output_xor, bool reflec
|
||||
Instantiates a CRC16 that will compute the CRC16 specified by the supplied
|
||||
@c polynomial and @c reset_value.
|
||||
*/
|
||||
Generator(IntType polynomial): value_(reset_value) {
|
||||
constexpr Generator(IntType polynomial) noexcept: value_(reset_value) {
|
||||
const IntType top_bit = IntType(~(IntType(~0) >> 1));
|
||||
for(int c = 0; c < 256; c++) {
|
||||
IntType shift_value = IntType(c << multibyte_shift);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ template <typename IntType = uint64_t, IntType polynomial = LSFRPolynomial<IntTy
|
||||
/*!
|
||||
Constructs an LFSR with a random initial value.
|
||||
*/
|
||||
LFSR() {
|
||||
constexpr LFSR() noexcept {
|
||||
// Randomise the value, ensuring it doesn't end up being 0;
|
||||
// don't set any top bits, in case this is a signed type.
|
||||
while(!value_) {
|
||||
|
||||
Reference in New Issue
Block a user