amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
One user-space repair task per eligible HWE debug-diag / compile-deploy base
ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content
filter. Each ships a public spec with a check-to-basis table, at least two
defects with single-fix fixtures, a symptom-masking fixture and an alternative
correct implementation. Claude re-checked all 320: structure, the HWE quality
items and trace6 Docker calibration receipts against current digests
(320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120
ad-hoc family names; the next batch maps them to the canonical list.
The batch's 1,256-line progress log stays in its factory report and the
36-local branch batch15-hwe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:55:56 +08:00

46 lines
1.0 KiB
C

#include "fields.h"
uint32_t pf_value_sum(const struct pf_bank *bank)
{
uint32_t index;
uint32_t result = 0u;
for (index = 0u; index < bank->count; ++index) {
result += bank->fields[index].value;
}
return result;
}
uint32_t pf_value_weight(const struct pf_bank *bank)
{
uint32_t index;
uint32_t result = 0u;
for (index = 0u; index < bank->count; ++index) {
result += bank->fields[index].id * bank->fields[index].value;
}
return result;
}
uint32_t pf_layout_span(const struct pf_bank *bank)
{
uint32_t index;
uint32_t result = 0u;
for (index = 0u; index < bank->count; ++index) {
uint32_t end = bank->fields[index].offset + bank->fields[index].width;
if (end > result) {
result = end;
}
}
return result;
}
uint32_t pf_free_bits(const struct pf_bank *bank)
{
uint32_t bits = pf_occupied(bank);
uint32_t occupied = 0u;
while (bits != 0u) {
occupied += bits & 1u;
bits >>= 1u;
}
return 32u - occupied;
}