mardi 4 août 2015

Strange behavior of bit-shift [duplicate]

Can't understand behavior of this bit shift:

int container = 1;

cout<<(container>>32)<<endl;

If it's logical shift the output should be 0, but it's 1 instead, as if it was cyclic shift. When looking at disassembly I see that command used is SAR. Please explain this behavior to me.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire