Hi Biterider!
Look like there is a problem in InsertAt method:
OCall xbx::DWordVector.Insert, 15
OCall xbx::DWordVector.Insert, 14
-----------------------------------
OCall xbx::DWordVector.InsertAt, 0, 15
OCall xbx::DWordVector.InsertAt, 0, 14
Test DWordVector
──────────────────────────────────────────────────────────────────────
esi = 0
DWORD ptr [xax] = 15
esi = 1
DWORD ptr [xax] = 14
──────────────────────────────────────────────────────────────────────
esi = 0
DWORD ptr [xax] = 14
esi = 1
DWORD ptr [xax] = -144682624
Thanks in advance, HSE.
Hi Hector
Thanks for the testbed code.
You are right :thumbsup:
I put the value assignment line in the wrong place.
I have attached the corrected version of TVector.inc.
Looking into
.for (esi = 0 : esi != [xbx].$Obj(DWordVector).dCount : esi++)
DbgDec esi
OCall xbx::DWordVector.ItemAt, esi
DbgDec DWORD ptr [xax]
.endfor
it works perfectly fine!
It could also be written like this
.VecForEach [xbx].$Obj(DWordVector), esi
DbgDec esi
DbgDec DWORD ptr [xax]
.VecNext
which is a bit more efficient, since it does not call .ItemAt
An alternative using implicit indexing is
.VecForEach [xbx].$Obj(DWordVector)
DbgDec DWORD ptr [xax]
.VecNext
Looking at the disassembly, I discovered an instruction that can be omitted. This little optimisation is implemented in the attached file.
Regards, Biterider
Hi Biterider!
Perfect now :thumbsup:
Thanks, HSE