This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.

Field

~import std/field

std/field — a dense 1-bit-per-cell buffer (bitset) over a flat u64 word array,

field.kz · 12 tors

std/field — a dense 1-bit-per-cell buffer (bitset) over a flat u64 word array, · 17 more lines
std/field — a dense 1-bit-per-cell buffer (bitset) over a flat u64 word array, with the same owned-handle ownership model as std/grid. Runtime-sized, single-owner, in-place mutable. This is RUNG 1 of the std/field (codename std/castles) vision: the bit-packed buffer primitive. What is Koru and what is the Zig leaf: the MARKING LOGIC (which cells, the strided sweep, the prime guard) lives in Koru flow on top of this module. Only the irreducible per-cell bit poke (set/test) and the popcount reduction (count) are the Zig leaf — exactly parallel to std/grid:set / std/grid:count-nonzero. The later cuts (the claims_descendants island that GENERATES the strided fill so even the per-cell call disappears) sit ABOVE this primitive — see docs/std_field_castles_vision.md. Ownership states (phantom on *Field): <field!> - new issues the obligation: this field must be freed. <field> - borrowed: read/mutate in place (set, test, count), obligation kept. <!field> - consumed: free discharges the obligation.

Phantom lifecycles

Derived from the phantom labels in the declarations below — state! issues an obligation the compiler will chase, !state discharges it, a bare state holds it without moving it. Nothing here is hand-drawn.

Field 1 state field!

new

comptimetransform koru_std/field.kz:73

new-heap

<field!> koru_std/field.kz:263

new.on-stack

comptimetransform <field!> koru_std/field.kz:289

new-instack

<field!> koru_std/field.kz:367

strike

<field> koru_std/field.kz:390

strike-wheel

<field> koru_std/field.kz:514

mark-multiples

comptimetransform <field> koru_std/field.kz:538

clear

<field> koru_std/field.kz:708

count-zeros

<field> koru_std/field.kz:727

free

<!field> koru_std/field.kz:755