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
|
|
@ -17,6 +17,8 @@
|
|||
#ifndef LIBDPF_INCLUDE_GROTTO_PRINCIPAL_LUT_HPP__
|
||||
#define LIBDPF_INCLUDE_GROTTO_PRINCIPAL_LUT_HPP__
|
||||
|
||||
#include "hedley/hedley.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
|
||||
|
|
@ -44,6 +46,7 @@ enum class principal : unsigned
|
|||
|
||||
inline constexpr unsigned principal_precisions[] = {8u, 12u, 16u, 20u, 24u, 28u, 32u};
|
||||
|
||||
HEDLEY_NO_THROW
|
||||
inline constexpr bool principal_precision(unsigned fractional_bits) noexcept
|
||||
{
|
||||
for (unsigned k : principal_precisions)
|
||||
|
|
@ -150,6 +153,7 @@ inline w256 w_mul_u64(w256 value, std::uint64_t factor)
|
|||
return out;
|
||||
}
|
||||
|
||||
HEDLEY_NO_THROW
|
||||
inline bool w_negative(w256 value) noexcept
|
||||
{
|
||||
return value.hi < 0;
|
||||
|
|
@ -311,7 +315,10 @@ inline w256 w_mul_i64(w256 value, std::int64_t factor)
|
|||
{
|
||||
if (factor >= 0)
|
||||
return w_mul_u64(value, static_cast<std::uint64_t>(factor));
|
||||
return w_neg(w_mul_u64(value, static_cast<std::uint64_t>(-factor)));
|
||||
// `-factor` is undefined at INT64_MIN. The magnitude is the unsigned wrap.
|
||||
const auto mag = static_cast<std::uint64_t>(0)
|
||||
- static_cast<std::uint64_t>(factor);
|
||||
return w_neg(w_mul_u64(value, mag));
|
||||
}
|
||||
|
||||
inline std::int64_t horner(const cubic_bits & piece, unsigned q, std::int64_t raw, unsigned fractional_bits)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue