aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_vmmath.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_vmmath.c b/src/lj_vmmath.c
index 970bb5ad..8ae8863b 100644
--- a/src/lj_vmmath.c
+++ b/src/lj_vmmath.c
@@ -44,11 +44,11 @@ int32_t LJ_FASTCALL lj_vm_modi(int32_t a, int32_t b)
44{ 44{
45 uint32_t y, ua, ub; 45 uint32_t y, ua, ub;
46 lua_assert(b != 0); /* This must be checked before using this function. */ 46 lua_assert(b != 0); /* This must be checked before using this function. */
47 ua = a < 0 ? -(uint32_t)a : (uint32_t)a; 47 ua = a < 0 ? (uint32_t)-a : (uint32_t)a;
48 ub = b < 0 ? -(uint32_t)b : (uint32_t)b; 48 ub = b < 0 ? (uint32_t)-b : (uint32_t)b;
49 y = ua % ub; 49 y = ua % ub;
50 if (y != 0 && (a^b) < 0) y = y - ub; 50 if (y != 0 && (a^b) < 0) y = y - ub;
51 if (((int32_t)y^b) < 0) y = -y; 51 if (((int32_t)y^b) < 0) y = (uint32_t)-(int32_t)y;
52 return (int32_t)y; 52 return (int32_t)y;
53} 53}
54#endif 54#endif