Some optimization

This commit is contained in:
momo5502
2016-06-08 17:28:58 +02:00
parent 2a64c578c7
commit 276e35e2d2
20 changed files with 59 additions and 64 deletions

View File

@ -167,6 +167,11 @@ namespace Utils
#pragma region JenkinsOneAtATime
unsigned int JenkinsOneAtATime::Compute(std::string data)
{
return JenkinsOneAtATime::Compute(data.data(), data.size());
}
unsigned int JenkinsOneAtATime::Compute(const char *key, size_t len)
{
unsigned int hash, i;

View File

@ -300,6 +300,7 @@ namespace Utils
class JenkinsOneAtATime
{
public:
static unsigned int Compute(std::string data);
static unsigned int Compute(const char *key, size_t len);
};
}

View File

@ -6,6 +6,8 @@ namespace Utils
{
void* data = new char[length];
assert(data != nullptr);
if (data)
{
ZeroMemory(data, length);
@ -23,7 +25,10 @@ namespace Utils
void Memory::Free(void* data)
{
delete[] data;
if (data)
{
delete[] data;
}
}
void Memory::Free(const void* data)

View File

@ -14,6 +14,11 @@ namespace Utils
this->RefMemory.clear();
}
~Allocator()
{
this->Free();
}
void Free()
{
for (auto i = this->RefMemory.begin(); i != this->RefMemory.end(); ++i)
{