Browse files

Remove unused decimal2string icall

  • Loading branch information...
1 parent 225b47e commit b52990befbe75b55c2553e301e5d6625d6baf6e0 @marek-safar marek-safar committed Aug 8, 2012
Showing with 1 addition and 131 deletions.
  1. +0 −11 mcs/class/corlib/System/Decimal.cs
  2. +0 −117 mono/metadata/decimal.c
  3. +0 −2 mono/metadata/decimal.h
  4. +1 −1 mono/metadata/icall-def.h
View
11 mcs/class/corlib/System/Decimal.cs
@@ -1366,10 +1366,6 @@ void IDeserializationCallback.OnDeserialization(object sender)
private static extern int decimalIncr (ref Decimal d1, ref Decimal d2);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern int decimal2string (ref Decimal val,
- int digits, int decimals, char[] bufDigits, int bufSize, out int decPos, out int sign);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern int string2decimal (out Decimal val, String sDigits, uint decPos, int sign);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1413,13 +1409,6 @@ void IDeserializationCallback.OnDeserialization(object sender)
private static extern int decimalIncr (ref Decimal d1, ref Decimal d2);
//![MethodImplAttribute(MethodImplOptions.InternalCall)]
- [DllImport("libdec", EntryPoint="decimal2string")]
- internal static extern int decimal2string (ref Decimal val,
- int digits, int decimals,
- [MarshalAs(UnmanagedType.LPWStr)]StringBuilder bufDigits,
- int bufSize, out int decPos, out int sign);
-
- //![MethodImplAttribute(MethodImplOptions.InternalCall)]
[DllImport("libdec", EntryPoint="string2decimal")]
internal static extern int string2decimal (out Decimal val,
[MarshalAs(UnmanagedType.LPWStr)]String sDigits,
View
117 mono/metadata/decimal.c
@@ -1116,123 +1116,6 @@ 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:
- * *pA == 0 => buf = "", *pDecPos = 1, *pSign = 0
- * *pA == 12.34 => buf = "1234", *pDecPos = 2, *pSign = 0
- * *pA == -1000.0000 => buf = "1", *pDecPos = 4, *pSign = 1
- * *pA == -0.00000076 => buf = "76", *pDecPos = -6, *pSign = 0
- *
- * Parameters:
- * pA decimal instance to convert
- * digits < 0: use decimals instead
- * = 0: gets mantisse as integer
- * > 0: gets at most <digits> digits, rounded according to banker's rule if necessary
- * decimals only used if digits < 0
- * >= 0: number of decimal places
- * buf pointer to result buffer
- * bufSize size of buffer
- * 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)
-{
- guint16 tmp[41];
- guint16 *buf = (guint16*) mono_array_addr(pArray, guint16, 0);
- guint16 *q, *p = tmp;
- decimal_repr aa;
- guint64 alo, ahi;
- guint32 rest;
- gint32 sigDigits, d;
- int i, scale, len;
-
- MONO_ARCH_SAVE_REGS;
-
- scale = pA->signscale.scale;
- DECTO128(pA, alo, ahi);
- sigDigits = calcDigits(alo, ahi); /* significant digits */
-
- /* calc needed digits (without leading or trailing zeros) */
- d = (digits == 0) ? sigDigits : digits;
- if (d < 0) { /* use decimals ? */
- if (0 <= decimals && decimals < scale) {
- d = sigDigits - scale + decimals;
- } else {
- d = sigDigits; /* use all you can get */
- }
- }
-
- if (sigDigits > d) { /* we need to round decimal number */
- DECCOPY(&aa, pA);
- aa.signscale.scale = DECIMAL_MAX_SCALE;
- mono_decimalRound(&aa, DECIMAL_MAX_SCALE - sigDigits + d);
- DECTO128(&aa, alo, ahi);
- sigDigits += calcDigits(alo, ahi) - d;
- }
-
- len = 0;
- if (d > 0) {
- /* get digits starting from the tail */
- for (; (alo != 0 || ahi != 0) && len < 40; len++) {
- div128by32(&alo, &ahi, 10, &rest);
- *p++ = '0' + (char) rest;
- }
- }
- *p = 0;
-
- if (len >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
-
- /* now we have the minimal count of digits,
- extend to wished count of digits or decimals */
- q = buf;
- if (digits >= 0) { /* count digits */
- if (digits >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
- if (len == 0) {
- /* zero or rounded to zero */
- *pDecPos = 1;
- } else {
- /* copy significant digits */
- for (i = 0; i < len; i++) {
- *q++ = *(--p);
- }
- *pDecPos = sigDigits - scale;
- }
- /* add trailing zeros */
- for (i = len; i < digits; i++) {
- *q++ = '0';
- }
- } else { /* count decimals */
- if (scale >= sigDigits) { /* add leading zeros */
- if (decimals+2 >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
- *pDecPos = 1;
- for (i = 0; i <= scale - sigDigits; i++) {
- *q++ = '0';
- }
- } else {
- if (sigDigits - scale + decimals+1 >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
- *pDecPos = sigDigits - scale;
- }
- /* copy significant digits */
- for (i = 0; i < len; i++) {
- *q++ = *(--p);
- }
- /* add trailing zeros */
- for (i = scale; i < decimals; i++) {
- *q++ = '0';
- }
- }
- *q = 0;
-
- *pSign = (sigDigits > 0) ? pA->signscale.sign : 0; /* zero has positive sign */
-
- return DECIMAL_SUCCESS;
-}
-
-/**
* mono_decimal2UInt64:
* @pA
* @pResult
View
2 mono/metadata/decimal.h
@@ -44,6 +44,4 @@ double mono_decimal2double(/*[In]*/decimal_repr* pA) MONO_INTERNAL;
gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp) MONO_INTERNAL;
gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, /*[In]*/MonoString* s, gint32 decrDecimal, gint32 sign) MONO_INTERNAL;
-gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, gint32 digits, gint32 decimals,
- /*[Out]*/MonoArray* pArray, gint32 bufSize, gint32* pDecPos, gint32* pSign) MONO_INTERNAL;
View
2 mono/metadata/icall-def.h
@@ -152,7 +152,7 @@ ICALL_TYPE(DECIMAL, "System.Decimal", DECIMAL_1)
ICALL(DECIMAL_1, "decimal2Int64", mono_decimal2Int64)
ICALL(DECIMAL_2, "decimal2UInt64", mono_decimal2UInt64)
ICALL(DECIMAL_3, "decimal2double", mono_decimal2double)
-ICALL(DECIMAL_4, "decimal2string", mono_decimal2string)
+//ICALL(DECIMAL_4, "decimal2string", mono_decimal2string)
ICALL(DECIMAL_5, "decimalCompare", mono_decimalCompare)
ICALL(DECIMAL_6, "decimalDiv", mono_decimalDiv)
ICALL(DECIMAL_7, "decimalFloorAndTrunc", mono_decimalFloorAndTrunc)

0 comments on commit b52990b

Please sign in to comment.