* mono-math.h mono-math.c: New file which contains implementations of
math functions/macros which are missing on some platforms.
svn path=/trunk/mono/; revision=19870
+2003-11-12 Zoltan Varga <vargaz@freemail.hu>
+
+ * mono-math.h mono-math.c: New file which contains implementations of
+ math functions/macros which are missing on some platforms.
+
2003-11-10 Dick Porter <dick@ximian.com>
* strenc.c: Use platform-endian UTF16
mono-sha1.c \
mono-logger.c \
monobitset.c \
+ mono-math.c \
strtod.h \
strtod.c \
strenc.h \
monobitset.h \
mono-digest.h \
mono-logger.h \
- mono-hash.h
+ mono-hash.h \
+ mono-math.h
EXTRA_DIST = ChangeLog
--- /dev/null
+
+#include "mono-math.h"
+
+#ifndef HAVE_SIGNBIT
+
+int
+mono_signbit_float (float x)
+{
+ union { float f; int i; } u = { f: x };
+
+ return u.i < 0;
+}
+
+int
+mono_signbit_double (double x)
+{
+ union { double d; int i[2]; } u = { d: x };
+
+ return u.i [1] < 0;
+}
+
+#endif
--- /dev/null
+
+#ifndef __MONO_SIGNBIT_H__
+#define __MONO_SIGNBIT_H__
+
+#include <math.h>
+
+#ifdef HAVE_SIGNBIT
+#define mono_signbit signbit
+#else
+#define mono_signbit(x) (sizeof (x) == sizeof (float) ? mono_signbit_float (x) : mono_signbit_double (x))
+
+int
+mono_signbit_double (double x);
+
+int
+mono_signbit_float (float x);
+
+#endif
+
+#endif