Bitwise Operators

J

Jared Contrascere

Hey,

I understand what Bitwise Operators are... and what they do, but what are
they good for? The only thing I can think of is quick mathematics (because
it doesn't really have to be computed) at a sacrifice of losing data. Can
anyone explain what they are good for?

Thanks,
Jared
 
V

Victor Bazarov

Jared Contrascere said:
I understand what Bitwise Operators are... and what they do, but what are
they good for? The only thing I can think of is quick mathematics (because
it doesn't really have to be computed) at a sacrifice of losing data. Can
anyone explain what they are good for?

If you have some kind of flag set, which you might want to keep
in a single integral variable (instead of in a bunch of bools),
the simplest way to set such flag is the bitwise OR, to clear or
check it is bitwise AND.

Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top