Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions include/boost/random/detail/polynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,12 @@ class polynomial
public:
reference(digit_t &value, int idx)
: _value(value), _idx(idx) {}
operator bool() const { return (_value & (digit_t(1) << _idx)) != 0; }
reference(const reference& other) = default;
reference(reference&& other) = default;
reference &operator=(const reference &other)
{
return *this = static_cast<bool>(other);
}
reference& operator=(bool b)
{
if(b) {
Expand All @@ -294,16 +299,14 @@ class polynomial
}
return *this;
}
operator bool() const { return (_value & (digit_t(1) << _idx)) != 0; }


reference &operator^=(bool b)
{
_value ^= (digit_t(b) << _idx);
return *this;
}

reference &operator=(const reference &other)
{
return *this = static_cast<bool>(other);
}
private:
digit_t &_value;
int _idx;
Expand Down Expand Up @@ -339,7 +342,7 @@ class polynomial
friend polynomial operator*(const polynomial &lhs, const polynomial &rhs);
friend polynomial mod_pow_x(boost::uintmax_t exponent, polynomial mod);
private:
std::vector<polynomial_ops::digit_t> _storage;
std::vector<digit_t> _storage;
std::size_t _size;
void ensure_bit(std::size_t i)
{
Expand Down
Loading