Posted: Sat Nov 02, 2024 5:53 am Post subject: Negative integer puzzle
Hello,
I have this code:
Code:
local i=readInteger(baseAddress+iOffset)
if i<0 and i>=(0-iTolerance) then e.DisplayMethod = 'dtSignedInteger'
elseif i>iTolerance then e.DisplayMethod = 'dtHexadecimal'
end
iTolerance is set to 100.
Negative integers between 0 and negative tolerance are displayed as HEX.
I must be missing something banally simple
Any ideas?
iTolerance = 100
addr = "30C11A44" -- ex..
local i=readInteger(addr,true)
print(i)
if i>=0 and i<=iTolerance then print('dtSignedInteger')
else print('dtHexadecimal')
end
-- res <0 ~ 100> = dtSignedInteger /// >0 ~ 100< = dtHexadecimal
-- i = -1 --> dtHexadecimal
-- i = 99 --> dtSignedInteger
-- i = 100 --> dtSignedInteger
-- i = 101 --> dtHexadecimal
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum