> PS. about more than 64 layers - I attached an example flag set class. Of
> course it's not as fast as a bare int/int64 (4 assembly instructions
> instead of one/two), but it brings type safety and automatic
> serialization (it's just a demo written in 20 minutes, not a quality code).
Tom,
That looks excellent.
I was also thinking bit set. The fact that std::bitset<> takes a size suggests
it is
putting the bits in the instance block, not in a separate block of memory.
Efficiency seems is more than adequate, and might even be more than adequate
even if
FLAG_SET::operator| () and FLAG_SET::operator& ()
were *not* inlined. It would be worth looking at how much code is put out for
those ops
to decide.
If we got rid of the tabs and we could use it tomorrow.
We probably need either 1) or 2) below so we can do:
if( bool( layer1 & layer2 ) )
{
}
1))))))))))))
FLAG_SET::operator bool () to return
return (bool) this.count();
2))))))))))))
change FLAG_SET::operator& () to return
return (bool) rv.count();
In this case you would also need a |= opertor and &= operator to assemble
LAYER_SETs.
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp