|
@@ -40,15 +40,14 @@ namespace Yitter.IdGenerator |
|
|
throw new ApplicationException("BaseTime error.");
|
|
|
throw new ApplicationException("BaseTime error.");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (options.SeqBitLength + options.WorkerIdBitLength > 22)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ApplicationException("error:WorkerIdBitLength + SeqBitLength <= 22");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (options.WorkerIdBitLength <= 0)
|
|
|
if (options.WorkerIdBitLength <= 0)
|
|
|
{
|
|
|
{
|
|
|
throw new ApplicationException("WorkerIdBitLength error.(range:[1, 21])");
|
|
|
throw new ApplicationException("WorkerIdBitLength error.(range:[1, 21])");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (options.SeqBitLength + options.WorkerIdBitLength > 22)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ApplicationException("error:WorkerIdBitLength + SeqBitLength <= 22");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
var maxWorkerIdNumber = Math.Pow(2, options.WorkerIdBitLength) - 1;
|
|
|
var maxWorkerIdNumber = Math.Pow(2, options.WorkerIdBitLength) - 1;
|
|
|
if (options.WorkerId < 0 || options.WorkerId > maxWorkerIdNumber)
|
|
|
if (options.WorkerId < 0 || options.WorkerId > maxWorkerIdNumber)
|
|
|