2013-05-29 15:14 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* src/vm/hashes.c
    ! fixed and optimized reordering when KEEPORDER flag is cleared
      in recent commit
This commit is contained in:
Przemysław Czerpak
2013-05-29 15:14:27 +02:00
parent c27bb280a0
commit e0238b29ce
2 changed files with 12 additions and 10 deletions

View File

@@ -10,6 +10,11 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-05-29 15:14 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/vm/hashes.c
! fixed and optimized reordering when KEEPORDER flag is cleared
in recent commit
2013-05-29 08:53 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/vm/hashes.c
% changed sorting algorithm for hash arrays which keeps item order.

View File

@@ -210,19 +210,16 @@ static int hb_hashItemCmp( PHB_ITEM pKey1, PHB_ITEM pKey2, int iFlags )
static void hb_hashResort( PHB_BASEHASH pBaseHash )
{
HB_SIZE nPos;
PHB_HASHPAIR pPairs = ( PHB_HASHPAIR )
hb_xgrab( pBaseHash->nLen * sizeof( HB_HASHPAIR ) );
for( nPos = 0; nPos < pBaseHash->nLen; ++nPos )
{
HB_SIZE nFrom = pBaseHash->pnPos[ nPos ];
if( nFrom != nPos )
{
HB_HASHPAIR pair;
memcpy( &pair, pBaseHash->pPairs + nPos, sizeof( HB_HASHPAIR ) );
memcpy( pBaseHash->pPairs + nPos, pBaseHash->pPairs + nFrom, sizeof( HB_HASHPAIR ) );
memcpy( pBaseHash->pPairs + nFrom, &pair, sizeof( HB_HASHPAIR ) );
}
memcpy( pPairs + nPos, pBaseHash->pPairs + pBaseHash->pnPos[ nPos ], sizeof( HB_HASHPAIR ) );
pBaseHash->pnPos[ nPos ] = nPos;
}
hb_xfree( pBaseHash->pPairs );
pBaseHash->pPairs = pPairs;
}
static void hb_hashSortDo( PHB_BASEHASH pBaseHash )