You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

IdGenerator.h 563 B

4 years ago
123456789101112131415161718192021222324252627282930
  1. /*
  2. * 版权属于:yitter(yitter@126.com)
  3. * 开源地址:https://gitee.com/yitter/idgenerator
  4. */
  5. #pragma once
  6. #include <stdio.h>
  7. #include <malloc.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <errno.h>
  11. #include "IdGenOptions.h"
  12. #include "SnowWorkerM1.h"
  13. #include "SnowWorkerM2.h"
  14. typedef struct IdGenerator {
  15. SnowFlakeWorker *Worker;
  16. uint64_t (*NextId)();
  17. } IdGenerator;
  18. static IdGenerator *_idGenerator = NULL;
  19. extern IdGenerator *GetIdGenInstance();
  20. extern void SetOptions(IdGeneratorOptions options);

雪花算法中非常好用的数字ID生成器