*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+
#include "fltcalc.h"
#include "strcalc.h"
# undef NAN
#endif
+#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
+#endif
+
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
-#ifdef linux
+#ifdef HAVE_ALLOCA_H
# include <alloca.h>
-#else
-# ifdef __APPLE__
-# include <stdlib.h>
-# endif
+#endif
+#ifdef HAVE_MALLOC_H
+# include <malloc.h>
#endif
typedef uint32_t UINT32;
* value is represented as a pseudo-struct char array, addressed
* by macros
* struct {
- * char sign; // 0 for positive, 1 for negative
+ * char sign; // 0 for positive, 1 for negative
* char exp[VALUE_SIZE];
* char mant[VALUE_SIZE];
* descriptor_t desc;
_fail_char(old_str, len, str - old_str);
}
}
- } // switch(state)
+ } /* switch(state) */
done:
sc_val_from_str(mant_str, strlen(mant_str), _mant(result));
#endif
#ifdef HAVE_LONG_DOUBLE
- TRACEPRINTF(("val_from_float(%.8X%.8X%.8X)\n", ((int*)&l)[2], ((int*)&l)[1], ((int*)&l)[0]));//srcval.val.high, srcval.val.mid, srcval.val.low));
+ TRACEPRINTF(("val_from_float(%.8X%.8X%.8X)\n", ((int*)&l)[2], ((int*)&l)[1], ((int*)&l)[0]));/* srcval.val.high, srcval.val.mid, srcval.val.low)); */
DEBUGPRINTF(("(%d-%.4X-%.8X%.8X)\n", sign, exponent, mantissa0, mantissa1));
#else
TRACEPRINTF(("val_from_float(%.8X%.8X)\n", srcval.val.high, srcval.val.low));
}
}
+void finish_fltcalc (void) {
+ free(calc_buffer); calc_buffer = NULL;
+}
+
/* definition of interface functions */
FC_DEFINE2(add)
FC_DEFINE2(sub)