News for hackers. Stuff that matters.
Re:Low Level Bit Hacks You Must Know by RiderOfGiraffes on Thursday October 21, 2010 @06:09AM (#1814869)
If you're handed a bit mask of events or flags then it can be used to iterate through the bits that are set, rather than all the bits.

    while flags!=0:
        right_most = flags & (-flags)
        process(right_most)
        flags &= ~right_most

There are no comments on this comment yet.