Bitwise operators

This is a discussion on Bitwise operators within the C Programming forums, part of the General Programming Boards category; "if ( status & 0x100 )" .. what is the meaning of this line .. and in the following line ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    20

    Bitwise operators

    "if ( status & 0x100 )" .. what is the meaning of this line ..

    and in the following line what does 0x007F means...
    "out = bioscom ( 2, 0, PORT ) & 0x007F"
    (i know the above line is to check data for error but what exactly 0x007F means.."
    Thanks
    Life is Like a Game.. You Just Dont Get 3 lives

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    >"if ( status & 0x100 )" .. what is the meaning of this line ..

    If bit 8 (counting from 0) is set in 'status'...

    >and in the following line what does 0x007F means...
    >"out = bioscom ( 2, 0, PORT ) & 0x007F"

    Use only the lower 7 bits of the value returned by the call to 'bioscom' (clear other bits).

    See also this FAQ.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    20
    i did'nt get it
    "If bit 8 (counting from 0) is set in 'status'..."

    can you plz explain it briefly ?
    Life is Like a Game.. You Just Dont Get 3 lives

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Code:
    0x100 -> 0000000100000000
                    ^       ^
                  bit8    bit0
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitwise operators
    By gnewfenix in forum C Programming
    Replies: 2
    Last Post: 05-16-2009, 09:43 PM
  2. Bitwise Operators
    By rrc55 in forum C Programming
    Replies: 6
    Last Post: 04-30-2009, 12:37 PM
  3. Palindromes and Bitwise operators
    By Dr Tornillo in forum C Programming
    Replies: 8
    Last Post: 08-02-2007, 03:31 PM
  4. bitwise and arithmetic Operators
    By Whiteghost in forum C Programming
    Replies: 4
    Last Post: 12-28-2006, 02:13 PM
  5. Bitwise Operators, Help!!
    By Mini__C in forum C Programming
    Replies: 6
    Last Post: 07-14-2004, 05:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21