Bug? IDE parsing HEX

peacemaker

Expert
Licensed User
Longtime User
B4X:
Sub Process_Globals
    Public Serial1 As Serial
    Dim bc As ByteConverter
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Delay(2000)
    Log(CRLF, "AppStart")
    BugTest
End Sub

Sub BugTest
    Dim i As ULong
    For i = 0x1FFFFFF To 0xFFFFFFFF - 1
        Log(bc.HexFromBytes(bc.ULongsToBytes(Array As ULong(i))))
    Next
End Sub

Works ?

Or

B4X:
Sub BugTest
    Dim i As ULong
    For i = 0 To 0xFFFFFFFF - 1
        Log(bc.HexFromBytes(bc.ULongsToBytes(Array As ULong(i))))
    Next
End Sub
 
Where is the question/bug? the code works or not?
 
As Erel replied in that post, there's room for improvement, so I guess it will be improved in the next update!
 
It looks like another bug here, the Erel's sample code works OK, but did you try this one ?
 
I don't know enough about bit banging and hex numbers to even know what I am looking at!
 
It's just a loop, but with hex counter.
 
Well, I would say that you are trying to subtract an integer from a Ulong here For i = 0x1FFFFFF To 0xFFFFFFFF - 1
What if you tried For i = 0x1FFFFFF To 0xFFFFFFFF - 0x000001?
 
Try

B4X:
Sub BugTest
    Dim i As ULong
    For i = 0 To 0xFFFFFFFF - 1
        Log(bc.HexFromBytes(bc.ULongsToBytes(Array As ULong(i))))
    Next
End Sub
 
Back
Top