1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Lost changes

This commit is contained in:
Brian Fiete 2021-02-25 10:14:22 -08:00
parent e6c4a95ccd
commit 8e9d7ed4c4
56 changed files with 1579 additions and 794 deletions

View file

@ -1,3 +1,8 @@
#define INITKNOWNFOLDERS
#include <guiddef.h>
#include <KnownFolders.h>
#undef INITKNOWNFOLDERS
#pragma warning(disable:4065)
#pragma warning(disable:4996)

View file

@ -164,17 +164,30 @@ public:
{
auto newHashHeads = (Entry**)TFuncs::AllocateZero(sizeof(Entry*) * newHashSize, alignof(Entry*));
SizedArray<Entry*, 32> entryList;
for (int hashIdx = 0; hashIdx < mHashSize; hashIdx++)
{
Entry* checkEntry = mHashHeads[hashIdx];
while (checkEntry != NULL)
if (checkEntry != NULL)
{
auto nextEntry = checkEntry->mNext;
int newHashIdx = (checkEntry->mHash & 0x7FFFFFFF) % newHashSize;
checkEntry->mNext = newHashHeads[newHashIdx];
newHashHeads[newHashIdx] = checkEntry;
checkEntry = nextEntry;
// We want to keep elements with equal hashes in their insert order so we need to
// iterate through the linked list in reverse
entryList.Clear();
while (checkEntry != NULL)
{
entryList.Add(checkEntry);
checkEntry = checkEntry->mNext;
}
for (int i = (int)entryList.mSize - 1; i >= 0; i--)
{
auto checkEntry = entryList[i];
int newHashIdx = (checkEntry->mHash & 0x7FFFFFFF) % newHashSize;
checkEntry->mNext = newHashHeads[newHashIdx];
newHashHeads[newHashIdx] = checkEntry;
}
}
}