Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
platform
MemoryTracking
AllocationHashTable.h
1
#pragma once
2
3
#include "Types.h"
4
#include <stdint.h>
5
6
namespace
Eegeo
7
{
8
struct
AllocationRecord;
9
10
class
AllocationHashTable
11
{
12
public
:
13
14
AllocationHashTable
();
15
16
void
AddRecord(
Eegeo::AllocationRecord
* record);
17
bool
RemoveRecord(
AllocationRecord
* target);
18
bool
FindRecord(
AllocationRecord
* target,
AllocationRecord
**& precedingNodeNext);
19
20
u64 GetEntryCount()
const
;
21
u32 GetBinCount()
const
;
22
AllocationRecord
* GetBin(u32 index);
23
24
private
:
25
26
static
u32 GetBinIndex(
AllocationRecord
* p)
27
{
28
u32 result;
29
30
// :TODO: Replace with std::hash when we go C++11-only.
31
// this isn't based on very much evidence, I just needed something fast & it seems to cause a decent spread
32
result =
static_cast<
u32
>
((((
reinterpret_cast<
uintptr_t
>
(p) >> 4) ^ ((u64)0x5FE4C1C2B9B84C09)) * ((u64)0x7E8A101488293D4D)) % BinCount);
33
34
return
result;
35
}
36
37
static
const
u32 BinCount = 1024;
38
AllocationRecord
* m_bins[BinCount];
39
u64 m_entryCount;
40
};
41
};
Generated on Sat Jun 10 2023 02:00:31 for eeGeo Platform SDK by
1.8.3.1