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
 

Cableguy

Expert
Licensed User
Longtime User
Where is the question/bug? the code works or not?
 

Cableguy

Expert
Licensed User
Longtime User
As Erel replied in that post, there's room for improvement, so I guess it will be improved in the next update!
 

peacemaker

Expert
Licensed User
Longtime User
It looks like another bug here, the Erel's sample code works OK, but did you try this one ?
 

Cableguy

Expert
Licensed User
Longtime User
I don't know enough about bit banging and hex numbers to even know what I am looking at!
 

peacemaker

Expert
Licensed User
Longtime User
It's just a loop, but with hex counter.
 

Cableguy

Expert
Licensed User
Longtime User
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?
 

peacemaker

Expert
Licensed User
Longtime User
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
 
Top