I think having a conversion from an array of bits into your bitwise integer (and vice versa) would be a good idea.
I'm not sure that bit_cmp(), which sounds like "bit compare" in my mental reading, quite fits with the OR or AND operations. It would make sense to me for the XOR (which is bits-not-equal) and XNOR (which is bits-are-equal, the same as ~($a ^ $b)), since those do a bitwise "compare". I guess the argument could be made that AND and OR are bitwise compares as well, but I don't think of them that way.) Since you're working with integers internally anyway, it seems easy enough just to use | & ^ ~(^) on the vars, rather than having a wrapper function to do the same thing. Then again, it wouldn't hurt...
As you can tell, I'm ambivalent whether bit_cmp() should be added. But I definitely vote to implement a conversion to/from a bit-array.
In reply to Re^3: merging two arrays with OR operation
by pryrt
in thread merging two arrays with OR operation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |