Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   IDA IDC-script: cannot shift right properly (https://forum.exetools.com/showthread.php?t=3771)

amitophia 03-28-2004 07:03

IDA IDC-script: cannot shift right properly
 
I have a little problem with idc-script
Here's an example:

Message("\n%X",0xC0665A84>>31);
Message("\n%X",0xC0665A84/0x80000000);

First resuls 0xFFFFFFFF, and second - 0;

What's a damn? The result must be 1 in both cases.

I have to implement ROR and ROL instructions in my IDC-script, but I can't 'cause the reason above.

Could someone tell me another way?

Thank you.

nino 03-28-2004 08:14

IDC uses signed arithmetic. Shift Right corresponds to SAR. Nevertheless you can still implement ROL and ROR keeping this in mind. :)

amitophia 03-28-2004 18:26

2 ninio:
Thanks a lot.

If someone need:
#define ROL(x,n) x<<n|(~(0xFFFFFFFF<<n)&x>>32-n)
#define ROR(x,n) x<<32-n|(~(0x80000000>>n-1)&x>>n)


All times are GMT +8. The time now is 14:39.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX