removed zero_new/zero_malloc,added hgl_set<uint8>

This commit is contained in:
2023-07-20 19:27:21 +08:00
parent 8bb5374ab1
commit 4d94b76683

View File

@@ -43,30 +43,6 @@ namespace hgl
constexpr u16char U16_FULL_WIDTH_SPACE=U16_TEXT(' '); //全角空格
constexpr u32char U32_FULL_WIDTH_SPACE=U32_TEXT(' '); //全角空格
template<typename T>
inline T *zero_new(const int count)
{
T *result=new T[count];
if(!result)
return(nullptr);
memset(result,0,count*sizeof(T));
return result;
}
template<typename T>
inline T *zero_malloc(const int count)
{
T *result=hgl_malloc(count*sizeof(T));
if(!result)
return(nullptr);
memset(result,0,count*sizeof(T));
return result;
}
template<typename T>
inline void hgl_call_construct(T *obj) //呼叫构造函数
{
@@ -405,6 +381,14 @@ namespace hgl
}
}
template<>
inline void hgl_set<uint8>(uint8 *data,const uint8 value,const size_t count)
{
if(!data||count<=0)return;
memset(data,value,count);
}
template<typename T>
inline void hgl_set(T *data,const T *src,const size_t count)
{