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:
Ryan Henry 2026-09-24 20:44:07 -06:00
parent 875f09fec1
commit 0d8a5a8131
97 changed files with 9212 additions and 1159 deletions

View file

@ -17,6 +17,7 @@
#include "dpf/twiddle.hpp"
#include "dpf/leaf_node.hpp"
#include "dpf/dcf.hpp"
#include "dpf/blocked_dcf.hpp"
#include "grotto/offset_iterable.hpp"
#include "dpf/path_memoizer.hpp"
#include "dpf/utils.hpp"
@ -29,6 +30,7 @@ namespace grotto
template <typename NodeT,
typename InputT>
HEDLEY_NO_THROW
auto parity_of_substring_prefix(const NodeT & node, InputT x) noexcept
{
static constexpr auto bits_per_limb = dpf::utils::bitlength_of_v<decltype(node[0])>;
@ -211,6 +213,7 @@ struct key_has_cmp<T, std::void_t<decltype(std::declval<const T &>().has_cmp())>
: std::true_type {};
template <typename KeyT>
HEDLEY_NO_THROW
uint64_t cmp_addend_raw(const KeyT & key) noexcept
{
if constexpr (dpf::is_party_key_v<KeyT>)
@ -263,7 +266,12 @@ static auto signed_prefix_parities(const DpfKey & dpf,
constexpr std::size_t depth = key_type::depth;
const auto & ch = dpf.cmp();
const std::size_t nbits = static_cast<std::size_t>(ch.nbits);
if (nbits > depth)
if constexpr (key_type::cmp_block > 0)
{
if (key_type::cmp_h > depth)
throw std::invalid_argument("signed_prefix_parities: comparison is deeper than the key");
}
else if (nbits > depth)
throw std::invalid_argument("signed_prefix_parities: comparison is deeper than the key");
const uint64_t mask = ch.mask;
@ -284,6 +292,11 @@ static auto signed_prefix_parities(const DpfKey & dpf,
prefixes[which] = addend & mask;
continue;
}
if constexpr (key_type::cmp_block > 0)
{
prefixes[which] = dpf::detail::blocked::eval_share(dpf, tx, path);
continue;
}
const std::size_t resume = dpf::detail::path_resume_for_level(
path, dpf, tx, nbits);
@ -363,7 +376,12 @@ static void signed_prefix_parities_into(const DpfKey & dpf,
constexpr std::size_t depth = key_type::depth;
const auto & ch = dpf.cmp();
const std::size_t nbits = static_cast<std::size_t>(ch.nbits);
if (nbits > depth)
if constexpr (key_type::cmp_block > 0)
{
if (key_type::cmp_h > depth)
throw std::invalid_argument("signed_prefix_parities: comparison is deeper than the key");
}
else if (nbits > depth)
throw std::invalid_argument("signed_prefix_parities: comparison is deeper than the key");
const uint64_t mask = ch.mask;
@ -382,6 +400,11 @@ static void signed_prefix_parities_into(const DpfKey & dpf,
out[which] = addend & mask;
continue;
}
if constexpr (key_type::cmp_block > 0)
{
out[which] = dpf::detail::blocked::eval_share(dpf, tx, path);
continue;
}
const std::size_t resume = dpf::detail::path_resume_for_level(
path, dpf, tx, nbits);