Annotate noexcept and constexpr with HEDLEY, and add interval containment, ChaCha, and the dyadic range tables.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
875f09fec1
commit
0d8a5a8131
97 changed files with 9212 additions and 1159 deletions
|
|
@ -187,7 +187,9 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
|
||||
/// @}
|
||||
|
||||
HEDLEY_NO_THROW
|
||||
bitstring & operator=(const bitstring &) noexcept = default;
|
||||
HEDLEY_NO_THROW
|
||||
bitstring & operator=(bitstring &&) noexcept = default;
|
||||
~bitstring() = default;
|
||||
|
||||
|
|
@ -387,6 +389,7 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
using base::flip;
|
||||
|
||||
/// @brief Flips every defined bit and clears bits above `Nbits`.
|
||||
HEDLEY_NO_THROW
|
||||
constexpr void flip() noexcept
|
||||
{
|
||||
base::flip();
|
||||
|
|
@ -468,6 +471,7 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
/// @note Does not perform bounds checking; behaviour is undefined if
|
||||
/// `pos` is out of bounds
|
||||
/// @return `data()[pos]`
|
||||
HEDLEY_NO_THROW
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
constexpr word_type data(size_type pos) const noexcept
|
||||
{
|
||||
|
|
@ -480,6 +484,7 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
/// @note Does not perform bounds checking; behaviour is undefined if
|
||||
/// `pos` is out of bounds
|
||||
/// @return `data()[pos]`
|
||||
HEDLEY_NO_THROW
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
constexpr word_type & data(size_type pos) noexcept
|
||||
{
|
||||
|
|
@ -488,6 +493,7 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
|
||||
/// @brief length of the underlying data array
|
||||
/// @return the number of elements in the underlying array
|
||||
HEDLEY_NO_THROW
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
constexpr size_type data_length() const noexcept
|
||||
{
|
||||
|
|
@ -497,6 +503,7 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
/// @brief returns the number of bits
|
||||
/// @returns number of bits that the `bitstring` holds
|
||||
/// @complexity `O(1)`
|
||||
HEDLEY_NO_THROW
|
||||
HEDLEY_PURE
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
constexpr size_type size() const noexcept
|
||||
|
|
@ -510,6 +517,7 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
std::array<word_type, data_length_> data_{};
|
||||
|
||||
/// @brief Mask of the bits that belong to this string in the high word.
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr word_type defined_high_mask() noexcept
|
||||
{
|
||||
constexpr auto rem = Nbits % bits_per_word;
|
||||
|
|
@ -519,6 +527,7 @@ class bitstring : public bit_array_base<bitstring<Nbits, WordT>, WordT>
|
|||
return static_cast<word_type>((word_type{1} << rem) - word_type{1});
|
||||
}
|
||||
|
||||
HEDLEY_NO_THROW
|
||||
constexpr void clear_unused() noexcept
|
||||
{
|
||||
if constexpr (Nbits % bits_per_word != 0)
|
||||
|
|
@ -630,6 +639,7 @@ struct countl_zero_symmetric_difference<dpf::bitstring<Nbits, WordT>>
|
|||
{
|
||||
using T = dpf::bitstring<Nbits, WordT>;
|
||||
|
||||
HEDLEY_NO_THROW
|
||||
HEDLEY_PURE
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
constexpr
|
||||
|
|
@ -706,6 +716,7 @@ struct make_from_integral_value<dpf::bitstring<Nbits, WordT>>
|
|||
using integral_type = std::conditional_t<std::is_void_v<T_integral_type>, simde_uint128, T_integral_type>;
|
||||
static constexpr auto mod = utils::mod_pow_2<integral_type>{};
|
||||
static constexpr auto bits_per_last_word = Nbits % T::bits_per_word;
|
||||
HEDLEY_NO_THROW
|
||||
constexpr dpf::bitstring<Nbits, WordT> operator()(integral_type val) const noexcept
|
||||
{
|
||||
dpf::bitstring<Nbits, WordT> ret;
|
||||
|
|
@ -731,6 +742,7 @@ struct mod_pow_2<dpf::bitstring<Nbits, WordT>>
|
|||
using T = dpf::bitstring<Nbits, WordT>;
|
||||
static constexpr auto to_int = to_integral_type<T>{};
|
||||
static constexpr auto mod = mod_pow_2<typename T::integral_type>{};
|
||||
HEDLEY_NO_THROW
|
||||
std::size_t operator()(T val, std::size_t n) const noexcept
|
||||
{
|
||||
return mod(to_int(val), n);
|
||||
|
|
@ -1141,14 +1153,23 @@ class numeric_limits<dpf::bitstring<Nbits, WordT>>
|
|||
= std::numeric_limits<typename dpf::bitstring<Nbits, WordT>::integral_type>::traps;
|
||||
static constexpr bool tinyness_before = false;
|
||||
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> min() noexcept { return dpf::bitstring<Nbits, WordT>{}; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> lowest() noexcept { return dpf::bitstring<Nbits, WordT>{}; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> max() noexcept { return ~dpf::bitstring<Nbits, WordT>{}; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> epsilon() noexcept { return 0; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> round_error() noexcept { return 0; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> infinity() noexcept { return 0; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> quiet_NaN() noexcept { return 0; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> signaling_NaN() noexcept { return 0; }
|
||||
HEDLEY_NO_THROW
|
||||
static constexpr dpf::bitstring<Nbits, WordT> denorm_min() noexcept { return 0; }
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue