is returning a wrong array. a first empty element is added to the array and the one that should be last has disappeared.
The sort is working fine with #PB_SORT_DESCENDING but i have to reverse the array in a second pass.
Is this a normal behavior? looks like a bug to me...
Code: Select all
Structure Point_t
x.f
y.f
z.f
EndStructure
Procedure EchoPoint(*p.Point_t)
Debug StrF(*p\x, 3)+","+ StrF(*p\y, 3)+","+ StrF(*p\z, 3)
EndProcedure
Dim points.Point_t(12)
Debug "-------------------- RAW ---------------------------"
For i = 0 To 11
Define *p.Point_t = points(i)
*p\y = Random(100)
EchoPoint(*p)
Next
SortStructuredArray(points(), #PB_Sort_Ascending, OffsetOf(Point_t\y), #PB_Float)
Debug "---------------------- SORTED ----------------------"
For i = 0 To 11
Define *p.Point_t = points(i)
EchoPoint(*p)
Next