0
The following C# methods take n bits and operates on them all in one pass.
// Sets n bits to zero at index i.
uint zerobits(uint x, int n, int i) {
return x & ~((uint.MaxValue >> (sizeof(uint) * 8 - n)) << i);
}
// Sets n bits to one at index i.
uint setbits(uint x, int n, int i) {
retu...