assert(nTrailingBitsToCount(0xF0u, 3u) == 7); assert(nTrailingBitsToCount(0xE00u, 3u) == 12); foreach(uint i; 1 .. 32) assert(nTrailingBitsToCount(uint.max, i) == i);
See Implementation