T
Travis
I don't have too much experience with bitwise operations. Here is what
I'm trying to accomplish. I have enum say:
enum myEnum { BILL = 0, KATIE = 1, JOHN = 2 }
Then I have an int that represents some combination of that enum,
like:
int WhoIsAllowed = BILL | KATIE | JOHN;
Then I wanted to be able to check an instance against the
WhoIsAllowed. like:
int KnockingAtDoor = BILL;
How can I check to see if BILL is in fact on the WhoIsAllowed?
I thought something like
if (KnockingAtDoor & WhoIsAllowed) { // let him in }
but it doesn't seem to be working.
Thanks.
I'm trying to accomplish. I have enum say:
enum myEnum { BILL = 0, KATIE = 1, JOHN = 2 }
Then I have an int that represents some combination of that enum,
like:
int WhoIsAllowed = BILL | KATIE | JOHN;
Then I wanted to be able to check an instance against the
WhoIsAllowed. like:
int KnockingAtDoor = BILL;
How can I check to see if BILL is in fact on the WhoIsAllowed?
I thought something like
if (KnockingAtDoor & WhoIsAllowed) { // let him in }
but it doesn't seem to be working.
Thanks.