#include "sve/sve.hpp"
namespace sve::scalar {
std::size_t count_gt_i32(std::span<const std::int32_t> d, std::int32_t thr) {
std::size_t c = 0;
for (auto x : d) c += static_cast<std::size_t>(x > thr);
return c;
}
std::size_t count_gt_f32(std::span<const float> d, float thr) {
std::size_t c = 0;
for (auto x : d) c += static_cast<std::size_t>(x > thr);
return c;
}
std::int64_t sum_i32(std::span<const std::int32_t> d) {
std::int64_t acc = 0;
for (auto x : d) acc += x;
return acc;
}
std::optional<size_t> find_i32(std::span<const std::int32_t> d, std::int32_t needle) {
for (std::size_t i = 0; i < d.size(); ++i)
if (d[i] == needle) return i;
return std::nullopt;
}
std::size_t filter_into_i32(std::span<const std::int32_t> d, std::int32_t thr,
std::span<std::int32_t> out) {
std::size_t w = 0;
for (auto x : d)
if (x > thr) out[w++] = x;
return w;
}
}