2009-12-01 Jb Evain <jbevain@novell.com>
[mono.git] / mono / metadata / decimal.h
blob1f3afd57c8dd89ccf584953c68452d4f27bcdec6
1 #include "mono/metadata/object.h"
2 #include "mono/utils/mono-compiler.h"
4 /* representation for C# type decimal */
5 /* This is the layout of MSC */
6 typedef struct
8 union {
9 guint32 ss32;
10 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
11 struct {
12 unsigned int sign : 1;
13 unsigned int reserved2 : 7;
14 unsigned int scale : 8;
15 unsigned int reserved1 : 16;
16 } signscale;
17 #else
18 struct {
19 unsigned int reserved1 : 16;
20 unsigned int scale : 8;
21 unsigned int reserved2 : 7;
22 unsigned int sign : 1;
23 } signscale;
24 #endif
25 } u;
26 guint32 hi32;
27 guint32 lo32;
28 guint32 mid32;
29 } decimal_repr;
32 /* function prototypes */
33 gint32 mono_decimalIncr(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB) MONO_INTERNAL;
34 gint32 mono_double2decimal(/*[Out]*/decimal_repr* pA, double val, gint32 digits) MONO_INTERNAL;
35 gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pD, guint64* pResult) MONO_INTERNAL;
36 gint32 mono_decimal2Int64(/*[In]*/decimal_repr* pD, gint64* pResult) MONO_INTERNAL;
37 void mono_decimalFloorAndTrunc(/*[In, Out]*/decimal_repr* pD, gint32 floorFlag) MONO_INTERNAL;
38 void mono_decimalRound(/*[In, Out]*/decimal_repr* pD, gint32 decimals) MONO_INTERNAL;
39 gint32 mono_decimalMult(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB) MONO_INTERNAL;
40 gint32 mono_decimalDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB) MONO_INTERNAL;
41 gint32 mono_decimalIntDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB) MONO_INTERNAL;
42 gint32 mono_decimalCompare(/*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB) MONO_INTERNAL;
43 double mono_decimal2double(/*[In]*/decimal_repr* pA) MONO_INTERNAL;
44 gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp) MONO_INTERNAL;
46 gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, /*[In]*/MonoString* s, gint32 decrDecimal, gint32 sign) MONO_INTERNAL;
47 gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, int digits, int decimals,
48 /*[Out]*/MonoArray* pArray, gint32 bufSize, gint32* pDecPos, gint32* pSign) MONO_INTERNAL;