Fix for shr with PHP (using >>)
This commit is contained in:
parent
8ec7c0af20
commit
77235947c1
1 changed files with 11 additions and 5 deletions
|
|
@ -452,11 +452,17 @@ proc arith(p: PProc, n: PNode, r: var TCompRes, op: TMagic) =
|
||||||
of mMulU: binaryUintExpr(p, n, r, "*")
|
of mMulU: binaryUintExpr(p, n, r, "*")
|
||||||
of mDivU: binaryUintExpr(p, n, r, "/")
|
of mDivU: binaryUintExpr(p, n, r, "/")
|
||||||
of mShrI:
|
of mShrI:
|
||||||
|
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:
|
||||||
var x, y: TCompRes
|
var x, y: TCompRes
|
||||||
gen(p, n.sons[1], x)
|
gen(p, n.sons[1], x)
|
||||||
gen(p, n.sons[2], y)
|
gen(p, n.sons[2], y)
|
||||||
let trimmer = unsignedTrimmer(n[1].typ.skipTypes(abstractRange).size)
|
let trimmer = unsignedTrimmer(n[1].typ.skipTypes(abstractRange).size)
|
||||||
r.res = "(($1 $2) >>> $3)" % [x.rdLoc, trimmer, y.rdLoc]
|
r.res = "(($1 $2) >> $3)" % [x.rdLoc, trimmer, y.rdLoc]
|
||||||
of mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mFloatToStr,
|
of mCharToStr, mBoolToStr, mIntToStr, mInt64ToStr, mFloatToStr,
|
||||||
mCStrToStr, mStrToStr, mEnumToStr:
|
mCStrToStr, mStrToStr, mEnumToStr:
|
||||||
if p.target == targetPHP:
|
if p.target == targetPHP:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue