[osg-users] Change to Optimizer OptimizationOptions

Paul Martz pmartz at skew-matrix.com
Wed Nov 4 08:51:48 PST 2009


Chris 'Xenon' Hanson wrote:
>   Oh, I love getting to wrangle theory with friends. ;)

You can call me an idiot if you want, and I'll still buy you coffee. :-)

> In the situation where they are unrelated state bits, being able to
> say stateBits.test(MY_STATE) it actually is perhaps more obvious and clear what's going on
> than doing it by hand with a bitwise operator.

I stand by my previous statement that it makes things less clear.

Suppose you're debugging and you encounter that in the code as you step 
through the debugger. You now need to step in and make sure it's doing 
the right thing, whereas (stateBits & MY_STATE) requires no debugging at 
all. This new class becomes just one more chunk of code to debug and vet.

And if performance is an issue, I now have to wonder what the StateBits 
class compiled to, whereas I know that (stateBits & MY_STATE) compiles 
to exactly one instruction.

Sorry to disagree on this, but I would no sooner write my own class to 
hide the bitwise AND operator than I would write my own class to hide 
the 32-bit integer addition operator.

Like I said, it's Robert's call, and we'll all go with what he says.
    -Paul



More information about the osg-users mailing list