Re: Bit mask

Discussion in 'C Programming' started by Eric, Jan 7, 2004.

  1. Eric

    Eric Guest

    Als <> wrote:

    > What's an efficient way to mask a last 3 bits of a 8-bit char and make them
    > all zero?


    unsigned char x = 90;

    x = x & ~7;



    --
    == Eric Gorr ========= http://www.ericgorr.net ========= ICQ:9293199 ===
    "Therefore the considerations of the intelligent always include both
    benefit and harm." - Sun Tzu
    == Insults, like violence, are the last refuge of the incompetent... ===
     
    Eric, Jan 7, 2004
    #1
    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. ex laguna
    Replies:
    11
    Views:
    1,404
    Peter Nilsson
    Jul 27, 2003
  2. Mark A. Odell

    Re: Bit mask

    Mark A. Odell, Jan 7, 2004, in forum: C Programming
    Replies:
    2
    Views:
    505
    Mark A. Odell
    Jan 7, 2004
  3. Eric Sosman

    Re: Bit mask

    Eric Sosman, Jan 7, 2004, in forum: C Programming
    Replies:
    0
    Views:
    450
    Eric Sosman
    Jan 7, 2004
  4. Marcin Tyman

    Conversion mask in hex to bit mask

    Marcin Tyman, May 6, 2008, in forum: Ruby
    Replies:
    4
    Views:
    821
    Robert Klemme
    May 6, 2008
  5. 187
    Replies:
    2
    Views:
    565
    Bart Lateur
    Jul 29, 2004
Loading...

Share This Page