rename hgl_aligned_malloc to hgl_align_malloc
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
#define hgl_free free
|
#define hgl_free free
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *hgl_aligned_malloc(size_t n)
|
inline T *hgl_align_malloc(size_t n)
|
||||||
{
|
{
|
||||||
return (T *)memalign(alignof(T),n*sizeof(T));
|
return (T *)memalign(alignof(T),n*sizeof(T));
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
#define hgl_free free
|
#define hgl_free free
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *hgl_aligned_malloc(size_t n)
|
inline T *hgl_align_malloc(size_t n)
|
||||||
{
|
{
|
||||||
return (T *)aligned_alloc(alignof(T),n*sizeof(T));
|
return (T *)aligned_alloc(alignof(T),n*sizeof(T));
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
#define hgl_free free
|
#define hgl_free free
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *hgl_aligned_malloc(size_t n)
|
inline T *hgl_align_malloc(size_t n)
|
||||||
{
|
{
|
||||||
return (T *)aligned_alloc(alignof(T),n*sizeof(T));
|
return (T *)aligned_alloc(alignof(T),n*sizeof(T));
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
#define hgl_free free
|
#define hgl_free free
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T *hgl_aligned_malloc(size_t n)
|
inline T *hgl_align_malloc(size_t n)
|
||||||
{
|
{
|
||||||
return (T *)hgl_malloc(n*sizeof(T));
|
return (T *)hgl_malloc(n*sizeof(T));
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ namespace hgl
|
|||||||
// if(!this->items)
|
// if(!this->items)
|
||||||
// {
|
// {
|
||||||
// this->max_count=1;
|
// this->max_count=1;
|
||||||
// this->items=(T **)hgl_aligned_malloc<T *>(1);
|
// this->items=(T **)hgl_align_malloc<T *>(1);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
@@ -238,7 +238,7 @@ namespace hgl
|
|||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// this->items=(T **)hgl_aligned_malloc<T *>(this->max_count);
|
// this->items=(T **)hgl_align_malloc<T *>(this->max_count);
|
||||||
//
|
//
|
||||||
// while(new_count--)
|
// while(new_count--)
|
||||||
// this->items[this->count++]=CreateObject();
|
// this->items[this->count++]=CreateObject();
|
||||||
|
@@ -17,7 +17,7 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
max_count=m;
|
max_count=m;
|
||||||
|
|
||||||
items=hgl_aligned_malloc<T>(max_count);
|
items=hgl_align_malloc<T>(max_count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
max_count=0;
|
max_count=0;
|
||||||
@@ -42,13 +42,13 @@ namespace hgl
|
|||||||
if(alloc_count==0)
|
if(alloc_count==0)
|
||||||
{
|
{
|
||||||
alloc_count=power_to_2(m);
|
alloc_count=power_to_2(m);
|
||||||
items=hgl_aligned_malloc<T>(alloc_count);
|
items=hgl_align_malloc<T>(alloc_count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(alloc_count<m)
|
if(alloc_count<m)
|
||||||
{
|
{
|
||||||
alloc_count=power_to_2(m);
|
alloc_count=power_to_2(m);
|
||||||
items=(T *)hgl_realloc(items,alloc_count*sizeof(T));
|
items=(T *)hgl_align_realloc<T>(items,alloc_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
max_count=m;
|
max_count=m;
|
||||||
@@ -169,12 +169,12 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
alloc_count=power_to_2(cur_count+1);
|
alloc_count=power_to_2(cur_count+1);
|
||||||
|
|
||||||
items=(T *)hgl_realloc(items,alloc_count*sizeof(T));
|
items=(T *)hgl_align_realloc<T>(items,alloc_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
items=hgl_aligned_malloc<T>(1);
|
items=hgl_align_malloc<T>(1);
|
||||||
|
|
||||||
alloc_count=1;
|
alloc_count=1;
|
||||||
}
|
}
|
||||||
@@ -209,12 +209,12 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
alloc_count=power_to_2(cur_count+data_count);
|
alloc_count=power_to_2(cur_count+data_count);
|
||||||
|
|
||||||
items=(T *)hgl_realloc(items,alloc_count*sizeof(T));
|
items=(T *)hgl_align_realloc<T>(items,alloc_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
items=hgl_aligned_malloc<T>(data_count);
|
items=hgl_align_malloc<T>(data_count);
|
||||||
|
|
||||||
alloc_count=data_count;
|
alloc_count=data_count;
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ namespace hgl
|
|||||||
else
|
else
|
||||||
alloc_count=max_count;
|
alloc_count=max_count;
|
||||||
|
|
||||||
items=hgl_aligned_malloc<T>(alloc_count);
|
items=hgl_align_malloc<T>(alloc_count);
|
||||||
|
|
||||||
memcpy(items,ori.items,alloc_count*sizeof(T));
|
memcpy(items,ori.items,alloc_count*sizeof(T));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user