AutoHotkey Community

It is currently May 27th, 2012, 12:13 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: May 22nd, 2011, 2:45 pm 
Offline

Joined: February 7th, 2008, 9:48 pm
Posts: 509
Code:
DecodeInteger(ptr)                   {
   Return *ptr | *++ptr << 8 | *++ptr << 16 | *++ptr << 24
             }


Can someone help explaining what this function calculates?In a reply from fragman i should replace it with NumGet.But i cannot figure out what it is doing :shock:


( Oh ...i believe it was code made by Skan :!: )


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2011, 2:58 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
ptr is a pointer
*ptr is the byte the pointer points to
++ptr moves to next byte
*++ptr is the byte at the new position
<<8 shift the bits 8 times to the left (mulitply by 256 (0x100))
++ptr moves to next byte
*++ptr is the byte at the new position
<<16 shift the bits 16 times to the left (mulitply by 256*256 (0x10000))
++ptr moves to next byte
*++ptr is the byte at the new position
<<24 shift the bits 24 times to the left (mulitply by 256*256*256 (0x1000000))

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2011, 3:27 pm 
Offline

Joined: February 7th, 2008, 9:48 pm
Posts: 509
Thanks Tonne

I will try it out with hex editor to get to the bottom of this :D

It seems you end up with 32 bits that are byte shifted in position ?

so reading bytes (pointer gets you "a") abcd becomes dcba ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2011, 3:48 pm 
All it's doing it digging out the integer pointed to by ptr
Code:
NumGet(&ptr,0,"Int")


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2011, 4:45 pm 
Offline

Joined: October 2nd, 2009, 12:43 pm
Posts: 283
It's in reversed byte order.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, Yahoo [Bot] and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group