zend_strtod_int.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.00 of the Zend 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.zend.com/license/2_00.txt. |
  11. | If you did not receive a copy of the Zend license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@zend.com so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Anatol Belski <ab@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef ZEND_STRTOD_INT_H
  19. #define ZEND_STRTOD_INT_H
  20. #ifdef ZTS
  21. #include <TSRM.h>
  22. #endif
  23. #include <stddef.h>
  24. #include <stdio.h>
  25. #include <ctype.h>
  26. #include <stdarg.h>
  27. #include <math.h>
  28. #ifdef HAVE_SYS_TYPES_H
  29. #include <sys/types.h>
  30. #endif
  31. /* TODO check to undef this option, this might
  32. make more perf. destroy_freelist()
  33. should be adapted then. */
  34. #define Omit_Private_Memory 1
  35. /* HEX strings aren't supported as per
  36. https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings */
  37. #define NO_HEX_FP 1
  38. #include <inttypes.h>
  39. #ifndef HAVE_INT32_T
  40. # if SIZEOF_INT == 4
  41. typedef int int32_t;
  42. # elif SIZEOF_LONG == 4
  43. typedef long int int32_t;
  44. # endif
  45. #endif
  46. #ifndef HAVE_UINT32_T
  47. # if SIZEOF_INT == 4
  48. typedef unsigned int uint32_t;
  49. # elif SIZEOF_LONG == 4
  50. typedef unsigned long int uint32_t;
  51. # endif
  52. #endif
  53. #ifdef USE_LOCALE
  54. #undef USE_LOCALE
  55. #endif
  56. #ifndef NO_INFNAN_CHECK
  57. #define NO_INFNAN_CHECK
  58. #endif
  59. #ifndef NO_ERRNO
  60. #define NO_ERRNO
  61. #endif
  62. #ifdef WORDS_BIGENDIAN
  63. #define IEEE_BIG_ENDIAN 1
  64. #else
  65. #define IEEE_LITTLE_ENDIAN 1
  66. #endif
  67. #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
  68. # if defined(__LITTLE_ENDIAN__)
  69. # undef WORDS_BIGENDIAN
  70. # else
  71. # if defined(__BIG_ENDIAN__)
  72. # define WORDS_BIGENDIAN
  73. # endif
  74. # endif
  75. #endif
  76. #if defined(__arm__) && !defined(__VFP_FP__)
  77. /*
  78. * * Although the CPU is little endian the FP has different
  79. * * byte and word endianness. The byte order is still little endian
  80. * * but the word order is big endian.
  81. * */
  82. #define IEEE_BIG_ENDIAN
  83. #undef IEEE_LITTLE_ENDIAN
  84. #endif
  85. #ifdef __vax__
  86. #define VAX
  87. #undef IEEE_LITTLE_ENDIAN
  88. #endif
  89. #ifdef IEEE_LITTLE_ENDIAN
  90. #define IEEE_8087 1
  91. #endif
  92. #ifdef IEEE_BIG_ENDIAN
  93. #define IEEE_MC68k 1
  94. #endif
  95. #if defined(_MSC_VER)
  96. #ifndef int32_t
  97. #define int32_t __int32
  98. #endif
  99. #ifndef uint32_t
  100. #define uint32_t unsigned __int32
  101. #endif
  102. #endif
  103. #ifdef ZTS
  104. #define MULTIPLE_THREADS 1
  105. #define ACQUIRE_DTOA_LOCK(x) \
  106. if (0 == x) { \
  107. tsrm_mutex_lock(dtoa_mutex); \
  108. } else if (1 == x) { \
  109. tsrm_mutex_lock(pow5mult_mutex); \
  110. }
  111. #define FREE_DTOA_LOCK(x) \
  112. if (0 == x) { \
  113. tsrm_mutex_unlock(dtoa_mutex); \
  114. } else if (1 == x) { \
  115. tsrm_mutex_unlock(pow5mult_mutex); \
  116. }
  117. #endif
  118. #endif /* ZEND_STRTOD_INT_H */