]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix compiler warning.
authorMike Pall <mike>
Tue, 7 Jun 2011 19:28:31 +0000 (21:28 +0200)
committerMike Pall <mike>
Tue, 7 Jun 2011 19:28:31 +0000 (21:28 +0200)
src/lj_vmmath.c

index 970bb5ad50d42e0064414a0fb1ce4fa5861967c0..8ae8863bc81c1d2a401af6d2952f725ad75085ea 100644 (file)
@@ -44,11 +44,11 @@ int32_t LJ_FASTCALL lj_vm_modi(int32_t a, int32_t b)
 {
   uint32_t y, ua, ub;
   lua_assert(b != 0);  /* This must be checked before using this function. */
-  ua = a < 0 ? -(uint32_t)a : (uint32_t)a;
-  ub = b < 0 ? -(uint32_t)b : (uint32_t)b;
+  ua = a < 0 ? (uint32_t)-a : (uint32_t)a;
+  ub = b < 0 ? (uint32_t)-b : (uint32_t)b;
   y = ua % ub;
   if (y != 0 && (a^b) < 0) y = y - ub;
-  if (((int32_t)y^b) < 0) y = -y;
+  if (((int32_t)y^b) < 0) y = (uint32_t)-(int32_t)y;
   return (int32_t)y;
 }
 #endif