ARST打卡第91周[91/521]
Algorithm
Review
Tips
Share
Ceph的encoding宏定义妙用
宏定义do_while(false)套娃
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 这中间还套娃了很多层do,while,这是我没有想到了
int main() {
cout << "hello world" << endl;
ENCODE_START(100)
DECODE_FINISH()
return 0;
}震惊宏定义缩短定义的方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21// -----------------------------------
// int types
WRITE_INTTYPE_ENCODER(uint64_t, le64)
WRITE_INTTYPE_ENCODER(int64_t, le64)
WRITE_INTTYPE_ENCODER(uint32_t, le32)
WRITE_INTTYPE_ENCODER(int32_t, le32)
WRITE_INTTYPE_ENCODER(uint16_t, le16)
WRITE_INTTYPE_ENCODER(int16_t, le16)