Jump to content
Sign in to follow this  
NutStomper

..

Recommended Posts

NutStomper
blankl.png Edited by NutStomper

Share this post


Link to post
Share on other sites
dany

You assume right. Basically you're treating the integer as if it was 64-bit and you shift it by 32. In this case you'll have to split the integer into two 32-bit values (high and low bit pair) and perform bitwise operation on the pair. I'm rather rusty in bitwise operations but some trail and error gave me this working script:

Local $a = 51162856125 ; = 97 * 0x1F7047DD
Local $aLow = BitAND($a / 4294967296, 0xFFFFFFFF) ; 4294967296 = 2^32, mask high bits.
Local $aHigh = BitAND(Mod($a, 4294967296), 0x00000000) ; mask low bits.
Local $b = BitShift($aLow, 32) + BitShift($aHigh, 32) ; shift
MsgBox(0, '', $b) ; 11

Your mileage may vary.

[edit] I'm unaware of any UDF that deals with bitwise operators btw. [/edit]

Edited by dany

[center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF

Share this post


Link to post
Share on other sites
dany

Glad it worked out. I also rolled a function out of it when I got a flashback. I've already seen a function called _BitShift64(), it's in Ward's Totally forgotten about it.

[edit] Oops:

Local $aLow = BitAND($a / 4294967296, 0xFFFFFFFF) ; 4294967296 = 2^32, mask high bits. <<<<<<<<< Actually $aHigh
Local $aHigh = BitAND(Mod($a, 4294967296), 0x00000000) ; mask low bits.<<<<<<<<< Actually $aLow

[/edit]

Edited by dany

[center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×