C=A^B other wise known as exclusive or (XOR)
if this isn't what you need, could you supply a truth table for us to look
over?
1 0 A
1 0 1
0 1 0
B
--Angus
______________________________ Forward Header __________________________________
Subject: Re: bitvector question
Author: INTERNET:CIRCLE@POST.QUEENSU.CA at CSERVE
Date: 4/28/98 4:11 PM
>Is there an easy way to compare two bitvectors and find what the difference
>is between the two?
If your bitvectors are normal ints, then for your example, simply
subtracting B's affects from A's affects will give you the value of all
the affects A has that B does not. Of course, if B has affects that
A does not, you'll get garbage. The function you described is probably
a fairly decent general case and should be reasonably efficient. I would
suspect there is something inordinately clever you could pull off, but I
can't think of it.
- Nasri.
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST