[System] Tweak socket test
[mono-project.git] / mono / metadata / number-ms.h
blobc6c7e3878702b1b9a2754e1d3e8b18c9241d2c40
1 #ifndef __MONO_NUMBER_MS_H__
2 #define __MONO_NUMBER_MS_H__
4 #include <glib.h>
6 // Double floating point Bias
7 #define MONO_DOUBLE_BIAS 1022
9 // Structure to access an encoded double floating point
10 typedef struct {
11 #if G_BYTE_ORDER == G_BIG_ENDIAN
12 guint sign : 1;
13 guint exp : 11;
14 guint mantHi : 20;
15 guint mantLo : 32;
16 #else // BIGENDIAN
17 guint mantLo : 32;
18 guint mantHi : 20;
19 guint exp : 11;
20 guint sign : 1;
21 #endif
22 } MonoDouble;
24 typedef union {
25 MonoDouble s;
26 gdouble d;
27 } MonoDouble_double;
29 // Single floating point Bias
30 #define MONO_SINGLE_BIAS 126
32 // Structure to access an encoded single floating point
33 typedef struct {
34 #if G_BYTE_ORDER == G_BIG_ENDIAN
35 guint sign : 1;
36 guint exp : 8;
37 guint mant : 23;
38 #else
39 guint mant : 23;
40 guint exp : 8;
41 guint sign : 1;
42 #endif
43 } MonoSingle;
45 typedef union {
46 MonoSingle s;
47 gfloat f;
48 } MonoSingle_float;
50 #define MONO_NUMBER_MAXDIGITS 50
52 typedef struct {
53 gint32 precision;
54 gint32 scale;
55 gint32 sign;
56 guint16 digits [MONO_NUMBER_MAXDIGITS + 1];
57 guint16 *allDigits;
58 } MonoNumber;
60 gint
61 mono_double_from_number (gpointer from, MonoDouble *target);
63 #endif