summary refs log tree commit diff stats
path: root/lib/system/jssys.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system/jssys.nim')
-rw-r--r--lib/system/jssys.nim12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim
index 24093a310..8065f2255 100644
--- a/lib/system/jssys.nim
+++ b/lib/system/jssys.nim
@@ -531,13 +531,13 @@ proc mulInt(a, b: int): int {.asmNoStackFrame, compilerproc.} =
 proc divInt(a, b: int): int {.asmNoStackFrame, compilerproc.} =
   when defined(nimphp):
     asm """
-      return floor(`a` / `b`);
+      return trunc(`a` / `b`);
     """
   else:
     asm """
       if (`b` == 0) `raiseDivByZero`();
       if (`b` == -1 && `a` == 2147483647) `raiseOverflow`();
-      return Math.floor(`a` / `b`);
+      return Math.trunc(`a` / `b`);
     """
 
 proc modInt(a, b: int): int {.asmNoStackFrame, compilerproc.} =
@@ -549,7 +549,7 @@ proc modInt(a, b: int): int {.asmNoStackFrame, compilerproc.} =
     asm """
       if (`b` == 0) `raiseDivByZero`();
       if (`b` == -1 && `a` == 2147483647) `raiseOverflow`();
-      return Math.floor(`a` % `b`);
+      return Math.trunc(`a` % `b`);
     """
 
 proc addInt64(a, b: int): int {.asmNoStackFrame, compilerproc.} =
@@ -594,13 +594,13 @@ proc mulInt64(a, b: int): int {.asmNoStackFrame, compilerproc.} =
 proc divInt64(a, b: int): int {.asmNoStackFrame, compilerproc.} =
   when defined(nimphp):
     asm """
-      return floor(`a` / `b`);
+      return trunc(`a` / `b`);
     """
   else:
     asm """
       if (`b` == 0) `raiseDivByZero`();
       if (`b` == -1 && `a` == 9223372036854775807) `raiseOverflow`();
-      return Math.floor(`a` / `b`);
+      return Math.trunc(`a` / `b`);
     """
 
 proc modInt64(a, b: int): int {.asmNoStackFrame, compilerproc.} =
@@ -612,7 +612,7 @@ proc modInt64(a, b: int): int {.asmNoStackFrame, compilerproc.} =
     asm """
       if (`b` == 0) `raiseDivByZero`();
       if (`b` == -1 && `a` == 9223372036854775807) `raiseOverflow`();
-      return Math.floor(`a` % `b`);
+      return Math.trunc(`a` % `b`);
     """
 
 proc negInt(a: int): int {.compilerproc.} =