字节对齐算法

//宏定义,字节对齐算法
//@x-表示字节数
//@a-表示多少个字节对齐
#define ALIGN(x, a)	(((x) + ((a) - 1)) & ~((a) - 1))

范例:

int size = ALIGN(101, 4);

size=104

int size = ALIGN(100, 4);
size=100

猜你喜欢

转载自blog.csdn.net/chenliang0224/article/details/80647332
今日推荐