Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
And even better ;-)))
int n=0xFEDCBA98; int b=40; Alert("n : "+ n +" "+IntegerToHexString(n)); Alert("b : "+ b +" "+IntegerToHexString(b)); Alert("n>>40 : "+ n>>40 +" "+IntegerToHexString(n>>40)); Alert("n>>b : "+ n>>b +" "+IntegerToHexString(n>>b)); Alert("0xFEDCBA98>>40 : "+ 0xFEDCBA98>>40 +" "+IntegerToHexString(0xFEDCBA98>>40)); Alert("0xFEDCBA98>>b : "+ 0xFEDCBA9>>b +" "+IntegerToHexString(0xFEDCBA98>>b)); Alert("n>>-40 : "+ n>>(-40) +" "+IntegerToHexString(n>>(-40))); Alert("n>>-b : "+ n>>(-b) +" "+IntegerToHexString(n>>(-b))); Alert("0xFEDCBA98>>-40 : "+ 0xFEDCBA98>>(-40) +" "+IntegerToHexString(0xFEDCBA98>>(-40))); Alert("0xFEDCBA98>>-b : "+ 0xFEDCBA98>>(-b) +" "+IntegerToHexString(0xFEDCBA98>>(-b)));... gives:
Positive shift:
variable >> literal ==> binary shift (modulo)
variable >> variable ==> binary shift (modulo)
literal >> literal ==> logical shift (modulo + sign propagation)
literal >> variable ==> binary shift (modulo)
Negative shift: same logic but returns bit overflow of revert shift
Moreover to compare result lines 3 and 4 with line 6 : 0x00FEDCBA value is not translated the same way ... actually 1043915 = 0x000FEDCB.
Enjoy !
Why those differences?