首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

分配内存储器的方法,需要32位对齐

2013-03-10 
分配内存的方法,需要32位对齐type 是char,short,int 。#define DATA_ALIGN1#ifDATA_ALIGN&& WIN32&& (_MSC_

分配内存的方法,需要32位对齐

type 是char,short,int 。


#define DATA_ALIGN  1#if   DATA_ALIGN  && WIN32  && (_MSC_VER > 1300)#define  my_malloc(type,len)    _aligned_malloc(sizeof(type) *(len), 32)#define  my_free(ptr)   _aligned_free(ptr)#else  // can't data align#define my_malloc(type,len)  malloc(sizeof(type) * (len))#define my_free(ptr)   free(ptr)#endif


热点排行