Document the new DPF surfaces in one command set, and test the field, half-tree, and multipoint edges.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ryan Henry 2026-09-24 23:18:10 -06:00
parent 0d8a5a8131
commit 0dff6df8ed
250 changed files with 12199 additions and 1981 deletions

View file

@ -1,6 +1,5 @@
/// @file dpf/offset_wrapper.hpp
/// @brief
/// @details
/// @brief An output value shifted by a public offset.
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @copyright Copyright (c) 2019-2024 Ryan Henry and [others](@ref authors)
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
@ -9,6 +8,9 @@
#ifndef LIBDPF_INCLUDE_DPF_OFFSET_WRAPPER_HPP__
#define LIBDPF_INCLUDE_DPF_OFFSET_WRAPPER_HPP__
#include <cstdint>
#include <utility>
#include "hedley/hedley.h"
namespace dpf
@ -43,6 +45,13 @@ struct offset_wrapper final
HEDLEY_NO_THROW
static constexpr bool is_wildcard() noexcept { return false; }
/// @brief Stored share. Concrete wrappers ignore it at evaluation.
/// @return the stored share
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
HEDLEY_NO_THROW
constexpr const input_type & raw() const noexcept { return offset_; }
private:
input_type offset_; // waste an `input_type` to make `sizeof` match up
};
@ -108,6 +117,34 @@ struct offset_wrapper<dpf::wildcard_value<ConcreteInputT>>
HEDLEY_PURE
HEDLEY_NO_THROW
static constexpr bool is_wildcard() noexcept { return true; }
/// @brief Party share, including before the offset is marked ready.
/// @return the party share
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
HEDLEY_NO_THROW
constexpr const input_type & raw() const noexcept { return offset_; }
/// @brief `offset_status` as a byte, for serialization.
/// @return the status byte
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
HEDLEY_NO_THROW
constexpr std::uint8_t state() const noexcept
{
return static_cast<std::uint8_t>(offset_state_);
}
/// @brief Restore a serialized share and status byte.
/// @param offset the party share
/// @param state the status byte
HEDLEY_ALWAYS_INLINE
void restore(input_type offset, std::uint8_t state) noexcept
{
offset_ = std::move(offset);
offset_state_ = static_cast<offset_status>(state);
}
private:
enum class offset_status : psnip_uint8_t { ready = 0, waiting = 1, computing = 2, notset = 3 };