mirror of
https://github.com/irmen/prog8.git
synced 2024-12-27 05:29:38 +00:00
fix: datatype mismatch in optimized bitshift const value
This commit is contained in:
parent
7426587c38
commit
2c7424fd43
@ -510,12 +510,12 @@ internal class ExpressionSimplifier(private val program: Program) : AstWalker()
|
|||||||
when (targetDt) {
|
when (targetDt) {
|
||||||
DataType.UBYTE, DataType.BYTE -> {
|
DataType.UBYTE, DataType.BYTE -> {
|
||||||
if (amount >= 8) {
|
if (amount >= 8) {
|
||||||
return NumericLiteralValue.optimalInteger(0, expr.position)
|
return NumericLiteralValue(targetDt, 0, expr.position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DataType.UWORD, DataType.WORD -> {
|
DataType.UWORD, DataType.WORD -> {
|
||||||
if (amount >= 16) {
|
if (amount >= 16) {
|
||||||
return NumericLiteralValue.optimalInteger(0, expr.position)
|
return NumericLiteralValue(targetDt, 0, expr.position)
|
||||||
} else if (amount >= 8) {
|
} else if (amount >= 8) {
|
||||||
val lsb = TypecastExpression(expr.left, DataType.UBYTE, true, expr.position)
|
val lsb = TypecastExpression(expr.left, DataType.UBYTE, true, expr.position)
|
||||||
if (amount == 8) {
|
if (amount == 8) {
|
||||||
|
Loading…
Reference in New Issue
Block a user