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.

php_snowdrift.h 2.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. +----------------------------------------------------------------------+
  3. | snowdrift |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: 63851587@qq.com |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id$ */
  19. #ifndef PHP_SNOWDRIFT_H
  20. #define PHP_SNOWDRIFT_H
  21. extern zend_module_entry snowdrift_module_entry;
  22. #define phpext_snowdrift_ptr &snowdrift_module_entry
  23. #define PHP_SNOWDRIFT_VERSION \
  24. "1.0.0" /* Replace with version number for your extension */
  25. #ifdef PHP_WIN32
  26. #define PHP_SNOWDRIFT_API __declspec(dllexport)
  27. #elif defined(__GNUC__) && __GNUC__ >= 4
  28. #define PHP_SNOWDRIFT_API __attribute__((visibility("default")))
  29. #else
  30. #define PHP_SNOWDRIFT_API
  31. #endif
  32. #ifdef ZTS
  33. #include "TSRM.h"
  34. #endif
  35. // PHP8
  36. #if PHP_VERSION_ID >= 80000
  37. #define TSRMLS_D void
  38. #define TSRMLS_DC
  39. #define TSRMLS_C
  40. #define TSRMLS_CC
  41. #define TSRMLS_FETCH()
  42. #define ZEND_ACC_DTOR 0
  43. #endif
  44. ZEND_BEGIN_MODULE_GLOBALS(snowdrift)
  45. uint8_t Method;
  46. uint64_t BaseTime;
  47. uint8_t WorkerId;
  48. uint8_t WorkerIdBitLength;
  49. uint8_t SeqBitLength;
  50. uint32_t MaxSeqNumber;
  51. uint32_t MinSeqNumber;
  52. uint16_t TopOverCostCount;
  53. ZEND_END_MODULE_GLOBALS(snowdrift)
  54. ZEND_DECLARE_MODULE_GLOBALS(snowdrift)
  55. #define SD_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(snowdrift, v)
  56. #if defined(ZTS) && defined(COMPILE_DL_SNOWDRIFT)
  57. ZEND_TSRMLS_CACHE_EXTERN()
  58. #endif
  59. static int snowdrift_init();
  60. #endif /* PHP_SNOWDRIFT_H */

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