bitvector question

From: Jon Barrett (mixtli@SINFO.NET)
Date: 04/28/98


Is there an easy way to compare two bitvectors and find what the difference
is between the two?

For example:
character A has AFF_BLIND|AFF_CURSE|AFF_BERSERK
character B has AFF_BLIND

Could I use a bitwise operator to fill a variable with
AFF_CURSE|AFF_BERSERK since both chars dont have them?  Would something
like diff = (charA aff) ^ (charB aff) work?
 Or would it just be easier to use a function to scroll through each affect
and use a if (IS_AFFECTED(A, (1<<x))==IS_AFFECTED(B, (1<<x))) check?
*>-Jon-<*

_________________________________________________________________________
"I have traveled the length and breadth of this country and talked with
the best people, and I can assure you that data processing is a fad that
won't last out the year."
      --The editor in charge of business books for Prentice Hall, 1957


     +------------------------------------------------------------+
     | 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