[osg-submissions] convert bitfields from magic numbers to bitshift notation
Bob Kuehne
rpk at blue-newt.com
Wed Apr 16 05:00:17 PDT 2008
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osg_bitfield_fixes.zip
Type: application/zip
Size: 8718 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080416/7979d9ee/attachment-0001.zip
More information about the osg-submissions
mailing list