* roottypes.cs: Rename from tree.cs.
[mono.git] / mono / metadata / decimal.c
index ca8c3fa783d85888add06ab41a2e8d456523b749..704c5dd5afd16ad478ef1f19fffbfc9b2eb8e7c7 100644 (file)
@@ -13,6 +13,7 @@
  * CSharp value type System.Decimal
  */
 
+#include "config.h"
 #include <mono/metadata/exception.h>
 #include <stdio.h>
 #include <memory.h>
@@ -20,6 +21,8 @@
 #include <string.h>
 #include <math.h>
 
+#ifndef DISABLE_DECIMAL
+
 /* needed for building microsoft dll */
 #ifdef __GNUC__
 #define DECINLINE __inline
@@ -28,7 +31,7 @@
 #endif
 
 #define LIT_GUINT32(x) x
-#define LIT_GUINT64(x) x##L
+#define LIT_GUINT64(x) x##LL
 
 
 /* we need a UInt64 type => guint64 */
@@ -924,7 +927,13 @@ gint32 mono_double2decimal(/*[Out]*/decimal_repr* pA, double val, gint32 digits)
     return pack128toDecimal(pA, alo, ahi, scale, sign);
 }
 
-/** 
+/**
+ * mono_string2decimal:
+ * @decimal_repr:
+ * @str:
+ * @decrDecimal:
+ * @sign:
+ *
  * converts a digit string to decimal
  * The significant digits must be passed as an integer in buf !
  *
@@ -1031,6 +1040,8 @@ gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, MonoString* str, gint32 de
 }
 
 /**
+ * mono_decimal2string:
+ * @
  * returns minimal number of digit string to represent decimal
  * No leading or trailing zeros !
  * Examples:
@@ -1051,7 +1062,6 @@ gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, MonoString* str, gint32 de
  *    pDecPos    receives insert position of decimal point relative to start of buffer
  *    pSign      receives sign
  */
-
 gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, gint32 digits, gint32 decimals,
                                    MonoArray* pArray, gint32 bufSize, gint32* pDecPos, gint32* pSign)
 {
@@ -1147,6 +1157,9 @@ gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, gint32 digits, gint32 decim
 }
 
 /**
+ * mono_decimal2UInt64:
+ * @pA
+ * @pResult
  * converts a decimal to an UInt64 without rounding
  */
 gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pA, guint64* pResult)
@@ -1170,6 +1183,9 @@ gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pA, guint64* pResult)
 }
 
 /**
+ * mono_decimal2Int64:
+ * @pA:
+ * pResult:
  * converts a decimal to an Int64 without rounding
  */
 gint32 mono_decimal2Int64(/*[In]*/decimal_repr* pA, gint64* pResult)
@@ -1454,6 +1470,17 @@ DECINLINE static void buildIEEE754Double(double* pd, int sign, int texp, guint64
 
     PRECONDITION(sign == 0 || sign == 1);
     *p = (((guint64)sign) << 63) | (((guint64)((1023+texp)&0x7ff)) << 52) | mantisse;
+#ifdef ARM_FPU_FPA
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+    {
+           guint32 temp;
+           guint32 *t = (guint32*)p;
+           temp = t [0];
+           t [0] = t [1];
+           t [1] = temp;
+    }
+#endif
+#endif
 }
 
 double mono_decimal2double(/*[In]*/decimal_repr* pA)
@@ -1544,3 +1571,6 @@ gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp)
         return DECIMAL_SUCCESS;
     }
 }
+
+#endif /* DISABLE_DECIMAL */
+