Snowflake limit
What's this limitation
4095
in @sapphire/snowflake
?5 Replies
GitHub
utilities/Snowflake.ts at main · sapphiredev/utilities
Common JavaScript utilities for Sapphire Projects. Contribute to sapphiredev/utilities development by creating an account on GitHub.
@kyra 🩵🩷🤍🩷🩵 ![ThisPoint](https://cdn.discordapp.com/emojis/1080514441906487326.png)
![ThisPoint](https://cdn.discordapp.com/emojis/1080514441906487326.png)
If you check the layout the snowflake has, you can see how many bits each part has:
As you can see, the increment can be one number between 0 (
And also the cycle should happen at 4096 (>4095 or >=4096), we're accidentally 1 possible increment off, I'll fix that ASAP, will update this message with a link to the PR https://github.com/sapphiredev/utilities/pull/596.
At the end, I encountered a lot more bugs. ![sweats](https://cdn.discordapp.com/emojis/781621120440860682.gif)
0b000000000000
) and 4095 (0b111111111111
). If you pass an increment, you're acknowledging you know what you're doing, as this is an advanced option.
As for what the behaviour is when we surpass the range [0, 4095], is completely specific to the implementation, there isn't really a single implementation that's intuitive for everyone.
However, now that you point it out, we should likely just mask it into the valid range, otherwise negative values get into the other fields, I have to fix that ![sweats](https://cdn.discordapp.com/emojis/781621120440860682.gif)
![sweats](https://cdn.discordapp.com/emojis/781621120440860682.gif)
Fixed in the latest release of the library
I reply a little bit late, but thanks! ❤️