From d8f9699debd435da5e1aef22c94c47154be4e2be Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 2 Apr 2025 21:13:03 +0300 Subject: fix big endian compilation + Code used some assumptions about type aliasing that might not hold for all systems --- src/interp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/interp.c') diff --git a/src/interp.c b/src/interp.c index 2d9b7c7..049498a 100644 --- a/src/interp.c +++ b/src/interp.c @@ -984,7 +984,18 @@ union interp_ret ejit_run(struct ejit_func *f, size_t paramc, struct ejit_arg pa DISPATCH(); DO(PARAM); - gpr[i.r2] = params[i.r0].u64; + switch (i.r1) { + case EJIT_INT8: gpr[i.r2] = params[i.r0].i8; break; + case EJIT_INT16: gpr[i.r2] = params[i.r0].i16; break; + case EJIT_INT32: gpr[i.r2] = params[i.r0].i32; break; + case EJIT_INT64: gpr[i.r2] = params[i.r0].i64; break; + case EJIT_UINT8: gpr[i.r2] = params[i.r0].u8; break; + case EJIT_UINT16: gpr[i.r2] = params[i.r0].u16; break; + case EJIT_UINT32: gpr[i.r2] = params[i.r0].u32; break; + case EJIT_UINT64: gpr[i.r2] = params[i.r0].u64; break; + case EJIT_POINTER: gpr[i.r2] = (int64_t)params[i.r0].p; break; + default: abort(); + } DISPATCH(); DO(PARAM_F); -- cgit v1.2.3