utility: added bit() for bitflag enums.
test/utils: added small encoding test.
Changed bitflag enums to use bit(); corrected order in ScriptWriter::Flags.