bitmask operations

Maybe, this is interesting for you, maybe not. feel free to merge.