17 lines
720 B
C++
17 lines
720 B
C++
#pragma once
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <span>
|
|
|
|
namespace gateway::spell_modifier {
|
|
struct SourceWeight { uint8_t bit; int8_t weight; };
|
|
// Weights must come from the qualified source-mask cohort. This function does
|
|
// not infer aura identity, deduplicate equal values, or qualify the weights.
|
|
// Every referenced bit must have an observed absolute aggregate (zero counts).
|
|
// Invalid/duplicate bits, weights other than +/-1, missing observations, or an
|
|
// unrepresentable total yield nullopt. Empty weights reconstruct exactly zero.
|
|
std::optional<int32_t> reconstruct(std::span<const SourceWeight> weights,
|
|
const std::array<int32_t, 64>& values, uint64_t observed) noexcept;
|
|
}
|