aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-04-02 21:13:03 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-04-02 21:13:03 +0300
commitd8f9699debd435da5e1aef22c94c47154be4e2be (patch)
tree3c01f1844a4832378f1fd288821200abcdfc3988 /tests
parenta9b21a1d5c55939cf3db1f3d5c857760601adb3b (diff)
downloadejit-d8f9699debd435da5e1aef22c94c47154be4e2be.tar.gz
ejit-d8f9699debd435da5e1aef22c94c47154be4e2be.zip
fix big endian compilation
+ Code used some assumptions about type aliasing that might not hold for all systems
Diffstat (limited to 'tests')
-rw-r--r--tests/escapei_10.c30
-rw-r--r--tests/escapei_double.c6
-rw-r--r--tests/escapei_float.c6
-rw-r--r--tests/escapei_immediate_10.c30
4 files changed, 24 insertions, 48 deletions
diff --git a/tests/escapei_10.c b/tests/escapei_10.c
index 4ae00b8..ec48df0 100644
--- a/tests/escapei_10.c
+++ b/tests/escapei_10.c
@@ -21,26 +21,16 @@ static int32_t func(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e,
static long escape_func(size_t argc, const struct ejit_arg args[argc])
{
assert(argc == 10);
- assert(args[0].type == EJIT_INT32);
- assert(args[1].type == EJIT_INT32);
- assert(args[3].type == EJIT_INT32);
- assert(args[4].type == EJIT_INT32);
- assert(args[5].type == EJIT_INT32);
- assert(args[6].type == EJIT_INT32);
- assert(args[7].type == EJIT_INT32);
- assert(args[8].type == EJIT_INT32);
- assert(args[9].type == EJIT_INT32);
-
- int32_t a = args[0].i32;
- int32_t b = args[1].i32;
- int32_t c = args[2].i32;
- int32_t d = args[3].i32;
- int32_t e = args[4].i32;
- int32_t f = args[5].i32;
- int32_t g = args[6].i32;
- int32_t h = args[7].i32;
- int32_t i = args[8].i32;
- int32_t j = args[9].i32;
+ int32_t a = EJIT_PARAM(argc, args, 0, int32_t);
+ int32_t b = EJIT_PARAM(argc, args, 1, int32_t);
+ int32_t c = EJIT_PARAM(argc, args, 2, int32_t);
+ int32_t d = EJIT_PARAM(argc, args, 3, int32_t);
+ int32_t e = EJIT_PARAM(argc, args, 4, int32_t);
+ int32_t f = EJIT_PARAM(argc, args, 5, int32_t);
+ int32_t g = EJIT_PARAM(argc, args, 6, int32_t);
+ int32_t h = EJIT_PARAM(argc, args, 7, int32_t);
+ int32_t i = EJIT_PARAM(argc, args, 8, int32_t);
+ int32_t j = EJIT_PARAM(argc, args, 9, int32_t);
return func(a, b, c, d, e, f, g, h, i, j);
}
diff --git a/tests/escapei_double.c b/tests/escapei_double.c
index 6ea9f90..736e978 100644
--- a/tests/escapei_double.c
+++ b/tests/escapei_double.c
@@ -9,10 +9,8 @@ static double func(int32_t a, double b) {
static double escape_func(size_t argc, const struct ejit_arg args[argc])
{
assert(argc == 2);
- assert(args[0].type == EJIT_INT32);
- assert(args[1].type == EJIT_DOUBLE);
- int32_t a = args[0].i32;
- double b = args[1].d;
+ int32_t a = EJIT_PARAM(argc, args, 0, int32_t);
+ double b = EJIT_PARAM(argc, args, 1, double);
return func(a, b);
}
diff --git a/tests/escapei_float.c b/tests/escapei_float.c
index 7a1b923..7cdc30d 100644
--- a/tests/escapei_float.c
+++ b/tests/escapei_float.c
@@ -9,10 +9,8 @@ static float func(int32_t a, float b) {
static float escape_func(size_t argc, const struct ejit_arg args[argc])
{
assert(argc == 2);
- assert(args[0].type == EJIT_INT32);
- assert(args[1].type == EJIT_FLOAT);
- int32_t a = args[0].i32;
- float b = args[1].f;
+ int32_t a = EJIT_PARAM(argc, args, 0, int32_t);
+ float b = EJIT_PARAM(argc, args, 1, float);
return func(a, b);
}
diff --git a/tests/escapei_immediate_10.c b/tests/escapei_immediate_10.c
index 381c79f..5517c35 100644
--- a/tests/escapei_immediate_10.c
+++ b/tests/escapei_immediate_10.c
@@ -21,26 +21,16 @@ static int32_t func(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e,
static long escape_func(size_t argc, const struct ejit_arg args[argc])
{
assert(argc == 10);
- assert(args[0].type == EJIT_INT32);
- assert(args[1].type == EJIT_INT32);
- assert(args[3].type == EJIT_INT32);
- assert(args[4].type == EJIT_INT32);
- assert(args[5].type == EJIT_INT32);
- assert(args[6].type == EJIT_INT32);
- assert(args[7].type == EJIT_INT32);
- assert(args[8].type == EJIT_INT32);
- assert(args[9].type == EJIT_INT32);
-
- int32_t a = args[0].i32;
- int32_t b = args[1].i32;
- int32_t c = args[2].i32;
- int32_t d = args[3].i32;
- int32_t e = args[4].i32;
- int32_t f = args[5].i32;
- int32_t g = args[6].i32;
- int32_t h = args[7].i32;
- int32_t i = args[8].i32;
- int32_t j = args[9].i32;
+ int32_t a = EJIT_PARAM(argc, args, 0, int32_t);
+ int32_t b = EJIT_PARAM(argc, args, 1, int32_t);
+ int32_t c = EJIT_PARAM(argc, args, 2, int32_t);
+ int32_t d = EJIT_PARAM(argc, args, 3, int32_t);
+ int32_t e = EJIT_PARAM(argc, args, 4, int32_t);
+ int32_t f = EJIT_PARAM(argc, args, 5, int32_t);
+ int32_t g = EJIT_PARAM(argc, args, 6, int32_t);
+ int32_t h = EJIT_PARAM(argc, args, 7, int32_t);
+ int32_t i = EJIT_PARAM(argc, args, 8, int32_t);
+ int32_t j = EJIT_PARAM(argc, args, 9, int32_t);
return func(a, b, c, d, e, f, g, h, i, j);
}