From 5450c944d708108dd5b10ff4f60c5bd69a4fb71d Mon Sep 17 00:00:00 2001 From: Hans Raaf Date: Mon, 7 Mar 2016 20:08:58 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20f=C3=BCr=20PHP=20codegen=20integer=20modu?= =?UTF-8?q?lo=20calculation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/jsgen.nim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 0cd0281afd..743626150a 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -472,6 +472,14 @@ proc arith(p: PProc, n: PNode, r: var TCompRes, op: TMagic) = r.res = "intval($1 / $2)" % [x.rdLoc, y.rdLoc] else: arithAux(p, n, r, op, jsOps) + of mModI: + if p.target == targetPHP: + var x, y: TCompRes + gen(p, n.sons[1], x) + gen(p, n.sons[2], y) + r.res = "($1 % $2)" % [x.rdLoc, y.rdLoc] + else: + arithAux(p, n, r, op, jsOps) of mShrI: var x, y: TCompRes gen(p, n.sons[1], x)