Merge pull request #13 from NineRec/patch-1

Update error log for wrong node id.
This commit is contained in:
Bruce 2018-04-11 20:05:44 -05:00 committed by GitHub
commit 68117e6bbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,16 +89,16 @@ type ID int64
// IDs
func NewNode(node int64) (*Node, error) {
if node < 0 || node > nodeMax {
return nil, errors.New("Node number must be between 0 and 1023")
}
// re-calc in case custom NodeBits or StepBits were set
nodeMax = -1 ^ (-1 << NodeBits)
nodeMask = nodeMax << StepBits
stepMask = -1 ^ (-1 << StepBits)
timeShift = NodeBits + StepBits
nodeShift = StepBits
if node < 0 || node > nodeMax {
return nil, errors.New("Node number must be between 0 and " + strconv.FormatInt(nodeMax, 10))
}
return &Node{
time: 0,