AnsweredAssumed Answered

Problem with shift operation

Question asked by Daniele Cortellazzi on Nov 24, 2014
Latest reply on Nov 24, 2014 by Erich Styger

Hi, i have this simple operation : image->start_sector = (((char)(*buff))<<24)|(((char)*(buff+1))<<16)|(((char)*(buff+2))<<8)|((char)*(buff+3));

 

where i concatenate 4 byte in a 32bit variable. the problem is when i shift the buff+1 << 16. The number that i have to obtain could be 0x3b9b2a00 but i have 0xff9b2a00. The problem is visible in the image, the other shift work well.Immagine.JPG.jpg

Outcomes