News:

Masm32 SDK description, downloads and other helpful links

Main Menu

Sort in SortedCollection

Started by HSE, August 30, 2020, 10:05:07 AM

Previous topic - Next topic

HSE

Hi Biterider!

SortedCollection work perfectly inserting items in order. :thumbsup:

Look like Sort after change Compare don't work at all.  Perhaps I'm missing the whole idea  :biggrin:
Equations in Assembly: SmplMath

Biterider

Hi HSE
You're right. There are two problems with the "Sort" method.
The first relates to the translation to x64 in line 179, which does not affect the 32-bit code.
The second is bad one. In line 178, an indirection is missing when the sorted item is reinserted.

I compiled the x86 and x64 versions and they seem to be working correctly.
I also attached the project because while reading the code I made some changes to format it the way I'm used to, but your original code is perfectly fine.

Biterider

HSE

Thanks Biterider  :thumbsup:

For a complete example must be replace the second OCall pDamnVector::MyDamnVector.ForEach, addr SetPosition, MyDamn_Position_in_Age, 0

with:OCall pDamnVector::MyDamnVector.ForEach, addr SetPosition, MyDamn_Position_in_LW, 0


:biggrin: :biggrin: Just in case we lost malt measure: DbgFloat [xax].$Obj(MyDamn).r8Attr[MyDamn_ID*sizeof(REAL8)]

Regards. HSE
Equations in Assembly: SmplMath

Biterider

Hi HSE
I optimized the Sort method a bit. if dCount > 0, the first item is kept in place and the sorting starts with the second item.  :icon_idea:
Can you check, it all is working right in your application using this version?

Regards, Biterider

HSE

Equations in Assembly: SmplMath