zend_strtod_int.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1998-2018 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. #if defined(HAVE_INTTYPES_H)
  39. #include <inttypes.h>
  40. #elif defined(HAVE_STDINT_H)
  41. #include <stdint.h>
  42. #endif
  43. #ifndef HAVE_INT32_T
  44. # if SIZEOF_INT == 4
  45. typedef int int32_t;
  46. # elif SIZEOF_LONG == 4
  47. typedef long int int32_t;
  48. # endif
  49. #endif
  50. #ifndef HAVE_UINT32_T
  51. # if SIZEOF_INT == 4
  52. typedef unsigned int uint32_t;
  53. # elif SIZEOF_LONG == 4
  54. typedef unsigned long int uint32_t;
  55. # endif
  56. #endif
  57. #ifdef USE_LOCALE
  58. #undef USE_LOCALE
  59. #endif
  60. #ifndef NO_INFNAN_CHECK
  61. #define NO_INFNAN_CHECK
  62. #endif
  63. #ifndef NO_ERRNO
  64. #define NO_ERRNO
  65. #endif
  66. #ifdef WORDS_BIGENDIAN
  67. #define IEEE_BIG_ENDIAN 1
  68. #else
  69. #define IEEE_LITTLE_ENDIAN 1
  70. #endif
  71. #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
  72. # if defined(__LITTLE_ENDIAN__)
  73. # undef WORDS_BIGENDIAN
  74. # else
  75. # if defined(__BIG_ENDIAN__)
  76. # define WORDS_BIGENDIAN
  77. # endif
  78. # endif
  79. #endif
  80. #if defined(__arm__) && !defined(__VFP_FP__)
  81. /*
  82. * * Although the CPU is little endian the FP has different
  83. * * byte and word endianness. The byte order is still little endian
  84. * * but the word order is big endian.
  85. * */
  86. #define IEEE_BIG_ENDIAN
  87. #undef IEEE_LITTLE_ENDIAN
  88. #endif
  89. #ifdef __vax__
  90. #define VAX
  91. #undef IEEE_LITTLE_ENDIAN
  92. #endif
  93. #ifdef IEEE_LITTLE_ENDIAN
  94. #define IEEE_8087 1
  95. #endif
  96. #ifdef IEEE_BIG_ENDIAN
  97. #define IEEE_MC68k 1
  98. #endif
  99. #if defined(_MSC_VER)
  100. #ifndef int32_t
  101. #define int32_t __int32
  102. #endif
  103. #ifndef uint32_t
  104. #define uint32_t unsigned __int32
  105. #endif
  106. #endif
  107. #ifdef ZTS
  108. #define MULTIPLE_THREADS 1
  109. #define ACQUIRE_DTOA_LOCK(x) \
  110. if (0 == x) { \
  111. tsrm_mutex_lock(dtoa_mutex); \
  112. } else if (1 == x) { \
  113. tsrm_mutex_lock(pow5mult_mutex); \
  114. }
  115. #define FREE_DTOA_LOCK(x) \
  116. if (0 == x) { \
  117. tsrm_mutex_unlock(dtoa_mutex); \
  118. } else if (1 == x) { \
  119. tsrm_mutex_unlock(pow5mult_mutex); \
  120. }
  121. #endif
  122. #endif /* ZEND_STRTOD_INT_H */
  123. /*
  124. * Local variables:
  125. * tab-width: 4
  126. * c-basic-offset: 4
  127. * indent-tabs-mode: t
  128. * End:
  129. * vim600: sw=4 ts=4 fdm=marker
  130. * vim<600: sw=4 ts=4
  131. */