Sign in to follow this  
Followers 0
tomaskir

Problem with Hex() after updating to 3.3.8

5 posts in this topic

#1 ·  Posted (edited)

Hey guys,

Having a bit of a problem after updating to 3.3.8.0. Here is a reproducer:

Local $base_address = "0x03820040"

Local $Clock_address = "0x" & Hex($base_address + 0x4)

MsgBox(0, "", "$base_address is " & Hex($base_address) & @CRLF & @CRLF & _
"$Clock_address is " & $Clock_address)

With 3.3.6.1 this returns:

$base_address is 03820040


$Clock_address is 0x03820044

With 3.3.8.0 this returns:

$base_address is 03820040


$Clock_address is 0x418C100220000000

I read through the change log and looked at changes to Hex(), but as far as I can see, none of them should break the script above.

Can anyone help me with this?

Thanks in advance,

tom

Edited by tomaskir

Share this post


Link to post
Share on other sites



you need to specific the wanted length, usually 8 bytes.

Local $base_address = 0x03820040
Local $Clock_address = "0x" & Hex($base_address + 0x4, 8)
MsgBox(0, "", "$base_address is " & Hex($base_address, 8) & @CRLF & @CRLF & _
"$Clock_address is " & $Clock_address)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

you need to specific the wanted length, usually 8 bytes.

Local $base_address = 0x03820040
Local $Clock_address = "0x" & Hex($base_address + 0x4, 8)
MsgBox(0, "", "$base_address is " & Hex($base_address, 8) & @CRLF & @CRLF & _
"$Clock_address is " & $Clock_address)

Doesnt work if

$base_address = "0x03820040"

Thats the main issue, $base_address in my case is a string.

Edited by tomaskir

Share this post


Link to post
Share on other sites

ahh, you add a number to a string and get a double. Convert it to an integer.

Local $base_address = "0x03820040"
Local $Clock_address = "0x" & Hex(Int($base_address + 0x4), 8)
MsgBox(0, "", "$base_address is " & Hex($base_address, 8) & @CRLF & @CRLF & _
"$Clock_address is " & $Clock_address)

Share this post


Link to post
Share on other sites

ahh, you add a number to a string and get a double. Convert it to an integer.

Local $base_address = "0x03820040"
Local $Clock_address = "0x" & Hex(Int($base_address + 0x4), 8)
MsgBox(0, "", "$base_address is " & Hex($base_address, 8) & @CRLF & @CRLF & _
"$Clock_address is " & $Clock_address)

Works :)

Thanks a lot!

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  
Followers 0