bit count if set bit count is reached or -1 otherwise.
import mir.ndslice.allocation: bitSlice; import mir.ndslice.topology: retro; auto s = bitSlice(1000); s[50] = true; s[100] = true; s[200] = true; s[300] = true; s[400] = true; assert(s.nBitsToCount(4) == 301); assert(s.retro.nBitsToCount(4) == 900);
Сount bits starting from the end until set bit count is reached. Works with ndslices created with mir.ndslice.topology.bitwise, mir.ndslice.allocation.bitSlice.