more tools for dealing with bitmasks