コード例 #1
0
ファイル: HashBase.cpp プロジェクト: ElishaMcNutt/Clockwork
void HashBase::AllocateBuckets(unsigned size, unsigned numBuckets)
{
    if (ptrs_)
        delete[] ptrs_;

    HashNodeBase** ptrs = new HashNodeBase* [numBuckets + 2];
    unsigned* data = reinterpret_cast<unsigned*>(ptrs);
    data[0] = size;
    data[1] = numBuckets;
    ptrs_ = ptrs;

    ResetPtrs();
}
コード例 #2
0
ファイル: HashBase.cpp プロジェクト: FloodProject/flood
NAMESPACE_CORE_BEGIN

void HashBase::AllocateBuckets(unsigned size, unsigned numBuckets)
{
    if (this->ptrs)
        Deallocate(this->ptrs);
    
    HashNodeBase** ptrs = static_cast<HashNodeBase**>(AllocatorAllocate(AllocatorGetHeap(), 
        (numBuckets + 2)*sizeof(HashNodeBase*), 0));
    unsigned* data = reinterpret_cast<unsigned*>(ptrs);
    data[0] = size;
    data[1] = numBuckets;
    this->ptrs = ptrs;
    
    ResetPtrs();
}