MessageClientIDSetter#createUniqID 中生成唯一id是否有误? #9143
coolmoon101
started this conversation in
General
Replies: 1 comment
-
版本:5.3.1 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
MessageClientIDSetter#createUniqID 在这个方法生成唯一id,方法内容简写如下:
char[] sb = new char[LEN * 2];
...
int pos = FIX_STRING.length;
UtilAll.writeInt(sb, pos, diff);
pos += 8;
...
我的问题:
(1)为什么这里要 LEN * 2 呢?
(2)pos += 8; 为什么是加8呢,是不是应该加4,如果这里加4,那sb的长度就不用乘2了吧
虽然结果没有问题,但是实现细节是不是可以优化呢?
Beta Was this translation helpful? Give feedback.
All reactions