Bitwise Operators

Discussion in 'C++' started by Jared Contrascere, Jul 19, 2003.

  1. 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
     
    Jared Contrascere, Jul 19, 2003
    #1
    1. Advertising

  2. "Jared Contrascere" <> wrote...
    > 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
     
    Victor Bazarov, Jul 19, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Hodkin

    ?bitwise operators

    Mike Hodkin, Jan 4, 2004, in forum: C++
    Replies:
    4
    Views:
    577
    Nick Hounsome
    Jan 6, 2004
  2. Replies:
    3
    Views:
    7,746
    Dave Thompson
    Sep 22, 2003
  3. Replies:
    12
    Views:
    2,724
    Slartibartfast
    Sep 23, 2003
  4. Andy

    how important are bitwise operators?

    Andy, Nov 10, 2003, in forum: C Programming
    Replies:
    8
    Views:
    702
    Mark A. Odell
    Nov 13, 2003
  5. Michael Foord

    Equivalent of Javascript Bitwise Operators

    Michael Foord, Oct 27, 2004, in forum: Python
    Replies:
    2
    Views:
    590
    Bengt Richter
    Oct 28, 2004
Loading...

Share This Page