[osg-submissions] convert bitfields from magic numbers to bitshift notation

Robert Osfield robert.osfield at gmail.com
Wed Apr 16 07:26:55 PDT 2008


Thanks Bob, these changes look perfectly reasonable and are now merged
and submitted to SVN.

On Wed, Apr 16, 2008 at 1:00 PM, Bob Kuehne <rpk at blue-newt.com> wrote:
> hi robert, the attached are conversions of the 3 main places i found in osg
> where tokens are used to represent bitmasks with 'magic' numbers, like 32.
> i've changed these to a more representative bitshift representation, showing
> clearly in which bit you can expect this token to manifest. ie, converted
> things like:
>
>  from:            DEEP_COPY_STATESETS         = 8,
>  to:              DEEP_COPY_STATESETS         = 1<<3,
>
>  showing clearly that this isn't the _value_ 8, but the _bit_ 8. this is an
> old pattern i see (and like to promulgate) to make code a bit more readable
> and maintainable. three headers are included from the trunk:
>
>   CopyOp, ReaderWriter, and GUIEventAdapter
>
>  thanks,
>  bob
>
>
>
> _______________________________________________
>  osg-submissions mailing list
>  osg-submissions at lists.openscenegraph.org
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>


More information about the osg-submissions mailing list