![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
小知识
wangyi1015
~
展开
-
内存对齐
// Structure Size example#include struct A { char a; long b; char c; long d; } ;struct B { char a; char c; long b; long d; } ;#pragma pack(push,1)struct C { char a; long b; ch原创 2009-03-15 19:19:00 · 458 阅读 · 0 评论 -
变量运算速度
整型在除法是要做转换,在其他运算中有明显的速度优势原创 2009-03-15 19:26:00 · 485 阅读 · 0 评论 -
转移表
// Table definition:typedef long (*functs)(char c);functs JumpTable[] = { DoOne,DoTwo,DoThree /* etc*/} ;// some code that uses the table:long result = JumpTable[selector](i++);转移表的内在的基本思路在于:将待调用函数的原创 2009-03-15 19:49:00 · 505 阅读 · 0 评论 -
比特域
struct BitField{ unsigned rangeAOne : 11; // long 1; unsigned rangeATwo : 11; unsigned rangeBOne : 10; unsigned rangeAThree : 11; // long 2; unsigned rangeAFour :原创 2009-03-15 19:37:00 · 602 阅读 · 0 评论