These lines in IdExtensions.IsSnowflake() contains constants that we can derive from the Id class:
long timestamp = id >> 22;
long thread = (id >> 17) & 0b11111;
long process = (id >> 12) & 0b11111;
long increment = id & 0b111111111111;
The numbers 22, 17 and 12 are just the sum of the (private) constants xxxBits, and the bitmasks are immediately available from the Id class.
I propose changes to the lines so that they use descriptive names:
long timestamp = id >> TimestampOffset;
long thread = (id >> ThreadOffset) & Id.ThreadIdMask;
long process = (id >> ProcessOffset) & Id.ProcessIdMask;
long increment = id & Id.IncrementMask;
I have a local branch with the required changes, and it has passed the unit tests.
If this idea works with you, I can create a pull request.
These lines in
IdExtensions.IsSnowflake()
contains constants that we can derive from theId
class:The numbers 22, 17 and 12 are just the sum of the (private) constants
xxxBits
, and the bitmasks are immediately available from the Id class.I propose changes to the lines so that they use descriptive names:
I have a local branch with the required changes, and it has passed the unit tests. If this idea works with you, I can create a pull request.