return (int)pass_floats (1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f);
}
+ public static bool is_small (float value) {
+ double d = (double)value;
+ double d2 = 7.183757E-41;
+ return d - d2 < 0.000001;
+ }
+
+ static int test_0_float_argument_passing_precision () {
+ float f = 7.183757E-41f;
+ return is_small (f) ? 0 : 1;
+ }
+
// The first argument must be passed on a dword aligned stack location
static int pass_byref_ints_longs (ref long a, ref int b, ref byte c, ref short d, ref long e, ref int f, ref long g) {
return (int)(a + b + c + d + e + f + g);
return 0;
}
- // 64-bits, 32-bit aligned
- struct struct1 {
- public int a;
- public int b;
- };
-
- static int check_struct1(struct1 x) {
- if (x.a != 1)
- return 1;
- if (x.b != 2)
- return 2;
- return 0;
- }
-
- static int pass_struct1(int a, int b, struct1 x) {
- if (a != 3)
- return 3;
- if (b != 4)
- return 4;
- return check_struct1(x);
- }
-
- static int pass_struct1(int a, struct1 x) {
- if (a != 3)
- return 3;
- return check_struct1(x);
- }
-
- static int pass_struct1(struct1 x) {
- return check_struct1(x);
- }
-
- static int test_0_struct1_args () {
- int r;
- struct1 x;
-
- x.a = 1;
- x.b = 2;
- if ((r = check_struct1(x)) != 0)
- return r;
- if ((r = pass_struct1(x)) != 0)
- return r + 10;
- if ((r = pass_struct1(3, x)) != 0)
- return r + 20;
- if ((r = pass_struct1(3, 4, x)) != 0)
- return r + 30;
- return 0;
- }
-
- // 64-bits, 64-bit aligned
- struct struct2 {
- public long a;
- };
-
- static int check_struct2(struct2 x) {
- if (x.a != 1)
- return 1;
- return 0;
- }
-
- static int pass_struct2(int a, int b, int c, struct2 x) {
- if (a != 3)
- return 3;
- if (b != 4)
- return 4;
- if (c != 5)
- return 5;
- return check_struct2(x);
- }
-
- static int pass_struct2(int a, int b, struct2 x) {
- if (a != 3)
- return 3;
- if (b != 4)
- return 4;
- return check_struct2(x);
- }
-
- static int pass_struct2(int a, struct2 x) {
- if (a != 3)
- return 3;
- return check_struct2(x);
- }
-
- static int pass_struct2(struct2 x) {
- return check_struct2(x);
- }
-
- static int test_0_struct2_args () {
- int r;
- struct2 x;
-
- x.a = 1;
- if ((r = check_struct2(x)) != 0)
- return r;
- if ((r = pass_struct2(x)) != 0)
- return r + 10;
- if ((r = pass_struct2(3, x)) != 0)
- return r + 20;
- if ((r = pass_struct2(3, 4, x)) != 0)
- return r + 30;
- if ((r = pass_struct2(3, 4, 5, x)) != 0)
- return r + 40;
- return 0;
- }
-
static void doit (double value, out long m) {
m = (long) value;
}