[Scummvm-devel] PS2 #9 : performance : node optimization : important

sunmax at libero.it sunmax at libero.it
Mon Mar 2 07:00:55 CET 2009


At the moment we have a set of bools "isDir", "isValid" flags.
+ methods and maybe even couple more platform specific flags
(eg. "isDev", "isRoot") that could be set at node creation
without need to check them over and over. To do this it would
be useful if we could have a "uint32 flags" in FSNode where
each bit has a defined meaning. Some as "isDir", "isValid" bits
would be universal, shared between all platforms, a chunk of
this uint32 flags would then be reserved for the backends.

So instead of having a isDir(), isValid(), etc list of methods.
we would just have a getFlags() where we can check the bits
with a binary AND. eg. if (node.getFlags() & _IS_DIR) ...

Maybe it's not the best solution, but I am just thinking of
some general way to get/set flags without polluting the API
and that can be shared between base class and derived ones.

Eg. on PS2 I could then do (node.getFlags() & _IS_DEV) using
the pool of bits reserved to backends, instead of having to
check every time with a strncmp if it's mc, usb, hd, etc.

Any other alternative is welcome.

Thanks!
 -max






More information about the Scummvm-devel mailing list