xref: /PHP-8.3/Zend/zend_strtod_int.h (revision 7473b86f)
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 
19 #ifndef ZEND_STRTOD_INT_H
20 #define ZEND_STRTOD_INT_H
21 
22 #ifdef ZTS
23 #include <TSRM.h>
24 #endif
25 
26 #include <stddef.h>
27 #include <stdio.h>
28 #include <ctype.h>
29 #include <stdarg.h>
30 #include <math.h>
31 
32 #ifdef HAVE_SYS_TYPES_H
33 #include <sys/types.h>
34 #endif
35 
36 /* TODO check to undef this option, this might
37 	make more perf. destroy_freelist()
38 	should be adapted then. */
39 #define Omit_Private_Memory 1
40 
41 /* HEX strings aren't supported as per
42 	https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings */
43 #define NO_HEX_FP 1
44 
45 #include <inttypes.h>
46 
47 #ifdef USE_LOCALE
48 #undef USE_LOCALE
49 #endif
50 
51 #ifndef NO_INFNAN_CHECK
52 #define NO_INFNAN_CHECK
53 #endif
54 
55 #ifndef NO_ERRNO
56 #define NO_ERRNO
57 #endif
58 
59 #ifdef WORDS_BIGENDIAN
60 #define IEEE_BIG_ENDIAN 1
61 #else
62 #define IEEE_LITTLE_ENDIAN 1
63 #endif
64 
65 #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
66 # if defined(__LITTLE_ENDIAN__)
67 #  undef WORDS_BIGENDIAN
68 # else
69 #  if defined(__BIG_ENDIAN__)
70 #   define WORDS_BIGENDIAN
71 #  endif
72 # endif
73 #endif
74 
75 #if defined(__arm__) && !defined(__VFP_FP__)
76 /*
77  *  * Although the CPU is little endian the FP has different
78  *   * byte and word endianness. The byte order is still little endian
79  *    * but the word order is big endian.
80  *     */
81 #define IEEE_BIG_ENDIAN
82 #undef IEEE_LITTLE_ENDIAN
83 #endif
84 
85 #ifdef __vax__
86 #define VAX
87 #undef IEEE_LITTLE_ENDIAN
88 #endif
89 
90 #ifdef IEEE_LITTLE_ENDIAN
91 #define IEEE_8087 1
92 #endif
93 
94 #ifdef IEEE_BIG_ENDIAN
95 #define IEEE_MC68k 1
96 #endif
97 
98 #if defined(_MSC_VER)
99 #ifndef int32_t
100 #define int32_t __int32
101 #endif
102 #ifndef uint32_t
103 #define uint32_t unsigned __int32
104 #endif
105 #endif
106 
107 #ifdef ZTS
108 #define MULTIPLE_THREADS 1
109 
110 #define  ACQUIRE_DTOA_LOCK(x) \
111 	if (0 == x) { \
112 		tsrm_mutex_lock(dtoa_mutex); \
113 	} else if (1 == x) { \
114 		tsrm_mutex_lock(pow5mult_mutex); \
115 	}
116 
117 #define FREE_DTOA_LOCK(x) \
118 	if (0 == x) { \
119 		tsrm_mutex_unlock(dtoa_mutex); \
120 	} else if (1 == x) { \
121 		tsrm_mutex_unlock(pow5mult_mutex); \
122 	}
123 
124 
125 #endif
126 
127 #endif /* ZEND_STRTOD_INT_H */
128