WUCANADA IP属地:美国

文章 关注 粉丝 访问 贡献
 
共 131 篇文章
显示摘要每页显示  条
#pragma pack() (Very ) Basically the compiler unless otherwise directed will line up structure members on2 byte or 4 byte boundaries - this makes it easier and faster for the processor to handle.#pragma pack(pop) //back to whatever the previous packing mode was.Without the pragma directive, the size of the structure i...
uint crc;程序 1-1,1-2,1-3 可以理解成移位前 crc 的 Bit15 与数据对应的 Bit(*ptr&i)做 XOR运算,根据此结果来决定是否执行 crc^=0x1021。假设通过移位处理了 8 个 bit 的数据,相当于把之前的 CRC 码的高字节(8bit)全部移出,与一个 byte 的数据做XOR 运算,根据运算结果来选择一个值(称为余式),与原来的 CRC 码再做一次 XOR 运算,就...
生成CRC码的多项式如下,其中CRC-16 和CRC-CCITT产生16 位的CRC码,而CRC-32 则产生的是32 位的CRC码,不同的标准计算出来的CRC值不同。
求解,将十进制转换为BCD码!来牛人啊!这是如何算出来的?lz找找二进制和十进制的转换吧。比如1101,就是1*2^(4-1)+1*2^(3-1)+0*2^(2-1)+1*2(1-1)也就是说从左到右 第1位的1后面有三位,那就1乘以2的三次方=8 第2位的1后面有二位,那就1乘以2的二次方=4 第3位的0后面有一位,那就0乘以2的一次方=0 第3位的1后面有...
sscanf函数的用法。以下是引用片段:  sscanf("123456abcdedfBCDEF","%[1-9a-z]",str);  printf("str=%s",str);以下是引用片段:  sscanf("123456abcdedfBCDEF","%[^A-Z]",str);  printf("str=%s",str);sscanf(log,"<%d>%s %s %s %d %d %s",&a1,str2...
不过把C函数写成宏也能达到加速的作用,不过必须是在程序完全除错之后,因为绝大多数除错程序不支持宏除错.与LISP之类的语言不同,C语言一开始就病态地喜欢用重复代码循环,许多C程序员(包括东楼)都是除非算法要求,坚决不用递归.事实上,C编译器们对优化递归调用一点都不反感,相反,它们还很喜欢干这件事.只有在递归函数需要传递大量参数,可能造成瓶...
int cmp(const void *a,const void *b){ return *((int *)a)-*((int *)b);#endif} #ifdef _INT_void FindMin(int *arr,int arr_size,int *result,int cmp(const void *a,const void *b))#elif _FLOAT_void FindMin(float *arr,int arr_size,float *result,int cmp(const void *a,const void *b))#elif _DOUBLE_void FindMin(double *arr,int ar...
关于sizeof的更多概述你可以在msdn总输入sizeof进行查询。事实上确实如此,目前,几乎所有平台上的所有版本的编译器都把指针的大小看做4byte,不信你试试sizeof(int*);sizeof(void*);sizeof(double*);首先sizeof(fun(a,b))的值:其正确是4,因为用sizeof求函数调用的大小时,它得到的是函数返回类型的大小,而fun(a,b)的返回类型是int,sizeof...
Optimizing loop overhead Many compilers can''t optimize certain loops into the form most suitable for them. Ordinarily most CPUs have a conditional branch mechanism that works well when counting down from a positive number to zero or negative one. The conditional clause for any for loop must be evaluated on...
帮助 | 留言交流 | 联系我们 | 服务条款 | 下载网文摘手 | 下载手机客户端
北京六智信息技术股份有限公司 Copyright© 2005-2024 360doc.com , All Rights Reserved
京ICP证090625号 京ICP备05038915号 京网文[2016]6433-853号 京公网安备11010502030377号
返回
顶部