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

@ -45,6 +45,8 @@
#include <string_view>
#include <type_traits>
#include "hedley/hedley.h"
#include "dpf/modint.hpp"
#include "dpf/utils.hpp"
@ -1492,6 +1494,7 @@ constexpr hit match_full(const program & p, const char * s, std::size_t n)
return run_id(c, root, 0, u256{}, nullptr, 0, 0);
}
HEDLEY_NON_NULL(4)
constexpr int unrank_node(const program & p, std::uint16_t id, u256 rank, char * out, int n);
constexpr int unrank_node(const program & p, std::uint16_t id, u256 rank, char * out, int n)
@ -1590,12 +1593,14 @@ constexpr int unrank_node(const program & p, std::uint16_t id, u256 rank, char *
return n;
}
HEDLEY_NON_NULL(3)
constexpr int unrank_root(const program & p, u256 rank, char * out)
{
if (!p.lang.all && cmp_card_u(rank, p.lang) >= 0) return -1;
return unrank_node(p, p.tree.root, rank, out, 0);
}
HEDLEY_NON_NULL(1)
constexpr program compile_pattern(const char * pattern)
{
program p{};
@ -1719,6 +1724,7 @@ class keyword2
constexpr keyword2(std::string_view str)
: parent(encode_(str)) { }
HEDLEY_NON_NULL(1)
constexpr keyword2(const char * str)
: keyword2(std::string_view(str)) { }
@ -1731,7 +1737,7 @@ class keyword2
constexpr keyword2 & operator=(const keyword2 &) noexcept = default;
constexpr keyword2 & operator=(keyword2 &&) noexcept = default;
~keyword2() = default;
~keyword2() noexcept = default;
/// @brief Rank, including values outside the language that fill the bit width.
static constexpr keyword2 from_rank(integral_type rank) noexcept