Fix for integer division in PHP codegen.
This commit is contained in:
parent
83592af8ed
commit
eda113889c
1 changed files with 8 additions and 0 deletions
|
|
@ -464,6 +464,14 @@ proc arith(p: PProc, n: PNode, r: var TCompRes, op: TMagic) =
|
|||
of mSubU: binaryUintExpr(p, n, r, "-")
|
||||
of mMulU: binaryUintExpr(p, n, r, "*")
|
||||
of mDivU: binaryUintExpr(p, n, r, "/")
|
||||
of mDivI:
|
||||
if p.target == targetPHP:
|
||||
var x, y: TCompRes
|
||||
gen(p, n.sons[1], x)
|
||||
gen(p, n.sons[2], y)
|
||||
r.res = "intval($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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue