Home

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.

previous
next

Re: Let's Unite Against Jews and Mongrels!
Error with Tkinter and tkMessageBox
OCBC connection
Re: Emacs + python
Re: What is going on here?
Mam Marzenie
Pajacyk
Dzieci Niczyje
Niechciane i Zapomniane
Fundacja Hobbit