Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

算法有问题,左移都不对 #4

Open
52fhy opened this issue Oct 24, 2019 · 0 comments
Open

算法有问题,左移都不对 #4

52fhy opened this issue Oct 24, 2019 · 0 comments

Comments

@52fhy
Copy link
Contributor

52fhy commented Oct 24, 2019

算法有问题。

static $workerIdShift = 10;
static $timestampLeftShift = 14;

这个应该分别是:

static $workerIdShift = 22;
static $timestampLeftShift = 12;

因为:
63 - 41 =22
63 - 51 = 12

另外,10个机器位,为什么要限制机器ID 小于15?小于 1024就行了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant