1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

sum = (sum >> 16) + (sum & 0xffff)

Discussion in 'C' started by en_7123, Mar 7, 2010.

  1. en_7123

    en_7123 New Member

    Joined:
    Feb 11, 2010
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    0
    What does this statement mean in c
    sum = (sum >> 16) + (sum & 0xffff)
    Thanks
     
  2. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    17
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    the above expression can be represented as:-

    sum=sum/(2^16) +sum


    becoz, (sum >> 16) means the sum divided by 2 to the power 16.. (refer to the meaning of bitwise left shift and bitwise right shidt)
    and
    (sum & 0xffff) itself gives sum.
     

Share This Page