79118430

Date: 2024-10-23 14:47:39
Score: 1
Natty:
Report link

To Jim Lahman's answer, there's an optimization you can do:

public void DoStuff(int mask)
{
    for (int i = 0; mask > 0; mask >>= 1)
    {
        if ((mask & 1) != 0)
        {
            array[i].DoSomeOtherStuff();
        }
        i++;
    }
}

This ensures that if your mask is 0000_0101 it will only iterate 3 times until it discovers there's no more bits to be found.

This doesn't allow negatives either, which in my case is what I want.

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: CaseyHofland