diff --git a/inc/hgl/Endian.h b/inc/hgl/Endian.h index 64ad774..e922c11 100644 --- a/inc/hgl/Endian.h +++ b/inc/hgl/Endian.h @@ -237,7 +237,7 @@ namespace hgl template T ToLittleEndian(T value){return value;} template inline void ToLittleEndian(T *,const int64){} - template inline void ToLittleEndian(D *dst,const S *src,const int64 count){hgl_cpy(dst,src,count);} + template inline void ToLittleEndian(D *dst,const S *src,const int64 count){typeconv(dst,src,count);} #endif//HGL_BIG_ENDIAN diff --git a/inc/hgl/TypeFunc.h b/inc/hgl/TypeFunc.h index 09edf30..002471f 100644 --- a/inc/hgl/TypeFunc.h +++ b/inc/hgl/TypeFunc.h @@ -505,7 +505,7 @@ namespace hgl } /** - * 等值类型复制 + * 同类型复制 */ template inline void hgl_cpy(T &dst,const T &src) @@ -514,10 +514,19 @@ namespace hgl } /** - * 不同类型数据块复制 + * 同类型指针数据复制 + */ + template + inline void hgl_cpy(T *dst,const T *src) + { + memcpy(dst,src,sizeof(T)); + } + + /** + * 数据类型转换赋值 */ template - inline void hgl_cpy(D *dst,const S *src,const size_t count) + inline void typeconv(D *dst,const S *src,const size_t count) { for(size_t i=0;i - inline void hgl_typecpy(T *dst,const T *src,const size_t count) + inline void hgl_cpy(T *dst,const T *src,const size_t count) { memcpy(dst,src,count*sizeof(T)); } @@ -540,7 +549,7 @@ namespace hgl * 同类型数据块移动 */ template - inline void hgl_typemove(T *dst,const T *src,const size_t count) + inline void hgl_move(T *dst,const T *src,const size_t count) { memmove(dst,src,count*sizeof(T)); } diff --git a/inc/hgl/type/StringInstance.h b/inc/hgl/type/StringInstance.h index 26779f9..6096dca 100644 --- a/inc/hgl/type/StringInstance.h +++ b/inc/hgl/type/StringInstance.h @@ -414,12 +414,12 @@ namespace hgl T *new_str=new T[malloc_length]; if(pos) - hgl_typecpy(new_str,buffer,pos); + hgl_cpy(new_str,buffer,pos); - hgl_typecpy(new_str+pos,istr,len); + hgl_cpy(new_str+pos,istr,len); if(pos