Bitwise Operators

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jared Contrascere

    Bitwise Operators

    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


  • Victor Bazarov

    #2
    Re: Bitwise Operators

    "Jared Contrascere" <nunz@neo.rr.co m> wrote...[color=blue]
    > 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[/color]
    (because[color=blue]
    > it doesn't really have to be computed) at a sacrifice of losing data.[/color]
    Can[color=blue]
    > anyone explain what they are good for?[/color]

    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


    Comment

    Working...