Skip to content
Draft
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
18 changes: 18 additions & 0 deletions include/intx/intx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,24 @@ struct uint
return static_cast<Int>(words_[0]);
}

uint& operator=(uint64_t v) noexcept {
words_[0] = v;
for (size_t i = 1; i < num_words; ++i)
words_[i] = 0;
return *this;
}

template <unsigned M>
constexpr uint& operator=(const uint<M>& x) noexcept
requires(M <= N)
{
for (size_t i = 0; i < uint<M>::num_words; ++i)
words_[i] = x[i];
for (size_t i = uint<M>::num_words; i < num_words; ++i)
words_[i] = 0;
return *this;
}

friend constexpr uint operator+(const uint& x, const uint& y) noexcept
{
return addc(x, y).value;
Expand Down