php_gmp_int.h 840 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef incl_PHP_GMP_INT_H
  2. #define incl_PHP_GMP_INT_H
  3. #ifdef HAVE_CONFIG_H
  4. #include "config.h"
  5. #endif
  6. #include "php.h"
  7. #include <gmp.h>
  8. #ifdef PHP_WIN32
  9. # define PHP_GMP_API __declspec(dllexport)
  10. #elif defined(__GNUC__) && __GNUC__ >= 4
  11. # define PHP_GMP_API __attribute__ ((visibility("default")))
  12. #else
  13. # define PHP_GMP_API
  14. #endif
  15. typedef struct _gmp_object {
  16. mpz_t num;
  17. zend_object std;
  18. } gmp_object;
  19. static inline gmp_object *php_gmp_object_from_zend_object(zend_object *zobj) {
  20. return (gmp_object *)( ((char *)zobj) - XtOffsetOf(gmp_object, std) );
  21. }
  22. PHP_GMP_API zend_class_entry *php_gmp_class_entry(void);
  23. /* GMP and MPIR use different datatypes on different platforms */
  24. #ifdef PHP_WIN32
  25. typedef zend_long gmp_long;
  26. typedef zend_ulong gmp_ulong;
  27. #else
  28. typedef long gmp_long;
  29. typedef unsigned long gmp_ulong;
  30. #endif
  31. #endif