Wed May 8 12:06:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / decimal.h
1 #include "mono/metadata/object.h"
2
3 /* representation for C# type decimal */
4 /* This is the layout of MSC */
5 typedef struct
6 {
7         union {
8                 guint32 ss32;
9             struct {
10                     unsigned int reserved1 : 16;
11                 unsigned int scale : 8; 
12                     unsigned int reserved2 : 7;
13                 unsigned int sign : 1; 
14                 } signscale;
15         } u;
16     guint32 hi32;
17     guint32 lo32;
18     guint32 mid32;
19 } decimal_repr;
20
21
22 /* function prototypes */
23 gint32 mono_decimalIncr(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
24 gint32 mono_double2decimal(/*[Out]*/decimal_repr* pA, double val, gint32 digits);
25 gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pD, guint64* pResult);
26 gint32 mono_decimal2Int64(/*[In]*/decimal_repr* pD, gint64* pResult);
27 void mono_decimalFloorAndTrunc(/*[In, Out]*/decimal_repr* pD, gint32 floorFlag);
28 void mono_decimalRound(/*[In, Out]*/decimal_repr* pD, gint32 decimals);
29 gint32 mono_decimalMult(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
30 gint32 mono_decimalDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
31 gint32 mono_decimalIntDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
32 gint32 mono_decimalCompare(/*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
33 double mono_decimal2double(/*[In]*/decimal_repr* pA);
34 gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp);
35
36 gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, /*[In]*/MonoString* s, gint32 decrDecimal, gint32 sign);
37 gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, int digits, int decimals,
38                          /*[Out]*/MonoArray* pArray, gint32 bufSize, gint32* pDecPos, gint32* pSign);
39