bit array operations
import mir.ndslice.slice: slicedField; import mir.ndslice.allocation: bitSlice; import mir.ndslice.dynamic: strided; import mir.ndslice.topology: iota, orthogonalReduceField; auto len = 100; auto a = len.bitSlice; auto b = len.bitSlice; auto c = len.bitSlice; a[len.iota.strided!0(7)][] = true; b[len.iota.strided!0(11)][] = true; c[len.iota.strided!0(13)][] = true; // this is valid since bitslices above are oroginal slices of allocated memory. auto and = orthogonalReduceField!"a & b"(size_t.max, [ a.iterator._field._field, // get raw data pointers b.iterator._field._field, c.iterator._field._field, ]) // operation on size_t .bitwiseField .slicedField(len); assert(and == (a & b & c));
Functional deep-element wise reduce of a slice composed of fields or iterators.