]> git.saurik.com Git - apple/libc.git/blobdiff - gdtoa/FreeBSD/gdtoaimp.h
Libc-763.11.tar.gz
[apple/libc.git] / gdtoa / FreeBSD / gdtoaimp.h
index e403aba83596393a0947a262b13fe9f64723eba8..2c188d66a0a4cc36ad07fa949da2fca686d8ed29 100644 (file)
@@ -113,7 +113,12 @@ THIS SOFTWARE.
  * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n)
  *     if memory is available and otherwise does something you deem
  *     appropriate.  If MALLOC is undefined, malloc will be invoked
- *     directly -- and assumed always to succeed.
+ *     directly -- and assumed always to succeed.  Similarly, if you
+ *     want something other than the system's free() to be called to
+ *     recycle memory acquired from MALLOC, #define FREE to be the
+ *     name of the alternate routine.  (FREE or free is only called in
+ *     pathological cases, e.g., in a gdtoa call after a gdtoa return in
+ *     mode 3 with thousands of digits requested.)
  * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making
  *     memory allocations from a private pool of memory when possible.
  *     When used, the private pool is PRIVATE_MEM bytes long:  2304 bytes,
@@ -126,8 +131,10 @@ THIS SOFTWARE.
  *     conversions of IEEE doubles in single-threaded executions with
  *     8-byte pointers, PRIVATE_MEM >= 7400 appears to suffice; with
  *     4-byte pointers, PRIVATE_MEM >= 7112 appears adequate.
- * #define INFNAN_CHECK on IEEE systems to cause strtod to check for
- *     Infinity and NaN (case insensitively).
+ * #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK
+ *     #defined automatically on IEEE systems.  On such systems,
+ *     when INFNAN_CHECK is #defined, strtod checks
+ *     for Infinity and NaN (case insensitively).
  *     When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
  *     strtodg also accepts (case insensitively) strings of the form
  *     NaN(x), where x is a string of hexadecimal digits (optionally
@@ -160,11 +167,6 @@ THIS SOFTWARE.
  * #define NO_STRING_H to use private versions of memcpy.
  *     On some K&R systems, it may also be necessary to
  *     #define DECLARE_SIZE_T in this case.
- * #define YES_ALIAS to permit aliasing certain double values with
- *     arrays of ULongs.  This leads to slightly better code with
- *     some compilers and was always used prior to 19990916, but it
- *     is not strictly legal and can cause trouble with aggressively
- *     optimizing compilers (e.g., gcc 2.95.1 under -O2).
  * #define USE_LOCALE to use the current locale's decimal_point value.
  */
 
@@ -268,25 +270,14 @@ Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
 
 typedef union { double d; ULong L[2]; } U;
 
-#ifdef YES_ALIAS
-#define dval(x) x
 #ifdef IEEE_8087
-#define word0(x) ((ULong *)&x)[1]
-#define word1(x) ((ULong *)&x)[0]
+#define word0(x) (x)->L[1]
+#define word1(x) (x)->L[0]
 #else
-#define word0(x) ((ULong *)&x)[0]
-#define word1(x) ((ULong *)&x)[1]
+#define word0(x) (x)->L[0]
+#define word1(x) (x)->L[1]
 #endif
-#else /* !YES_ALIAS */
-#ifdef IEEE_8087
-#define word0(x) ((U*)&x)->L[1]
-#define word1(x) ((U*)&x)->L[0]
-#else
-#define word0(x) ((U*)&x)->L[0]
-#define word1(x) ((U*)&x)->L[1]
-#endif
-#define dval(x) ((U*)&x)->d
-#endif /* YES_ALIAS */
+#define dval(x) (x)->d
 
 /* The following definition of Storeinc is appropriate for MIPS processors.
  * An alternative that might be better on some machines is
@@ -460,7 +451,7 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
 #define FREE_DTOA_LOCK(n)      /*nothing*/
 #endif
 
-#define Kmax 15
+#define Kmax 9
 
  struct
 Bigint {
@@ -566,14 +557,14 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
  extern double ratio ANSI((Bigint*, Bigint*));
  extern void rshift ANSI((Bigint*, int));
  extern char *rv_alloc ANSI((int));
- extern Bigint *s2b ANSI((CONST char*, int, int, ULong));
+ extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
  extern Bigint *set_ones ANSI((Bigint*, int));
  extern char *strcp ANSI((char*, const char*));
  extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
  extern double strtod ANSI((const char *s00, char **se));
  extern Bigint *sum ANSI((Bigint*, Bigint*));
  extern int trailz ANSI((Bigint*));
- extern double ulp ANSI((double));
+ extern double ulp ANSI((U*));
 
 #ifdef __cplusplus
 }
@@ -588,6 +579,10 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
  * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.)
  */
 #ifdef IEEE_Arith
+#ifndef NO_INFNAN_CHECK
+#undef INFNAN_CHECK
+#define INFNAN_CHECK
+#endif
 #ifdef IEEE_MC68k
 #define _0 0
 #define _1 1