/// @file dpf/prg_dummy.hpp /// @brief /// @details /// @author Ryan Henry /// @copyright Copyright (c) 2019-2024 Ryan Henry and [others](@ref authors) /// @license Released under a GNU General Public v2.0 (GPLv2) license; /// see [LICENSE.md](@ref license) for details. #ifndef LIBDPF_INCLUDE_DPF_PRG_DUMMY_HPP__ #define LIBDPF_INCLUDE_DPF_PRG_DUMMY_HPP__ #include #include #include #include "hedley/hedley.h" #include "portable-snippets/exact-int/exact-int.h" #include "dpf/utils.hpp" namespace dpf { namespace prg { struct dummy final { using block_type = simde__m128i; HEDLEY_NO_THROW HEDLEY_ALWAYS_INLINE HEDLEY_CONST static block_type eval(block_type seed, psnip_uint32_t) noexcept { return seed; } HEDLEY_NO_THROW HEDLEY_ALWAYS_INLINE HEDLEY_CONST static auto eval01(block_type seed) noexcept { HEDLEY_PRAGMA(GCC diagnostic push) HEDLEY_PRAGMA(GCC diagnostic ignored "-Wignored-attributes") return std::array{seed, seed}; HEDLEY_PRAGMA(GCC diagnostic pop) } HEDLEY_NO_THROW HEDLEY_ALWAYS_INLINE static void eval(block_type seed, block_type * HEDLEY_RESTRICT output, psnip_uint32_t count_, psnip_uint32_t = 0) noexcept { std::fill_n(output, count_, seed); } HEDLEY_NO_THROW HEDLEY_ALWAYS_INLINE static void eval01_x4(const block_type * HEDLEY_RESTRICT seeds, block_type * HEDLEY_RESTRICT left, block_type * HEDLEY_RESTRICT right) noexcept { for (std::size_t i = 0; i < 4; ++i) { left[i] = right[i] = seeds[i]; } } HEDLEY_NO_THROW HEDLEY_ALWAYS_INLINE static void eval_x4(const block_type * HEDLEY_RESTRICT seeds, block_type * HEDLEY_RESTRICT output, psnip_uint32_t = 0) noexcept { std::copy_n(seeds, 4, output); } HEDLEY_NO_THROW HEDLEY_ALWAYS_INLINE static void eval_x8(const block_type * HEDLEY_RESTRICT seeds, block_type * HEDLEY_RESTRICT output, psnip_uint32_t = 0) noexcept { std::copy_n(seeds, 8, output); } /// Raw-bit subtractive share of `T` for party `Party` (see `prg.hpp`). template static auto expand(block_type seed, psnip_uint32_t pos = 0) noexcept; }; // struct dummy } // namespace prg } // namespace dpf #endif // LIBDPF_INCLUDE_DPF_PRG_DUMMY_HPP__