fix stack corruption with bitshifts

This commit is contained in:
Irmen de Jong 2020-11-24 21:58:14 +01:00
parent 09f25ffbd9
commit a88b40d6c1

View File

@ -1619,9 +1619,9 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
} }
} }
">>" -> { ">>" -> {
translateExpression(expr.left)
val amount = expr.right.constValue(program)?.number?.toInt() val amount = expr.right.constValue(program)?.number?.toInt()
if(amount!=null) { if(amount!=null) {
translateExpression(expr.left)
when (leftDt) { when (leftDt) {
DataType.UBYTE -> { DataType.UBYTE -> {
if (amount <= 2) if (amount <= 2)
@ -1669,9 +1669,9 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
} }
} }
"<<" -> { "<<" -> {
translateExpression(expr.left)
val amount = expr.right.constValue(program)?.number?.toInt() val amount = expr.right.constValue(program)?.number?.toInt()
if(amount!=null) { if(amount!=null) {
translateExpression(expr.left)
if (leftDt in ByteDatatypes) { if (leftDt in ByteDatatypes) {
if (amount <= 2) if (amount <= 2)
repeat(amount) { asmgen.out(" asl P8ESTACK_LO+1,x") } repeat(amount) { asmgen.out(" asl P8ESTACK_LO+1,x") }