2022-06-04 15:52:56 +02:00
|
|
|
From c764ca71a639f5585b5f466bea25dc42b855a4b0 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
|
|
|
|
Date: Mon, 25 Apr 2022 14:42:51 -0300
|
|
|
|
Subject: [PATCH] Bug: Wrong code generation in bitwise operations
|
|
|
|
|
|
|
|
---
|
2023-05-01 00:05:58 +02:00
|
|
|
src/lcode.c | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
2022-06-04 15:52:56 +02:00
|
|
|
|
|
|
|
--- a/src/lcode.c
|
|
|
|
+++ b/src/lcode.c
|
2023-05-01 00:05:58 +02:00
|
|
|
@@ -1531,7 +1531,7 @@ static void codecommutative (FuncState *
|
2022-06-04 15:52:56 +02:00
|
|
|
static void codebitwise (FuncState *fs, BinOpr opr,
|
2023-05-01 00:05:58 +02:00
|
|
|
expdesc *e1, expdesc *e2, int line) {
|
2022-06-04 15:52:56 +02:00
|
|
|
int flip = 0;
|
2023-05-01 00:05:58 +02:00
|
|
|
- if (e1->k == VKINT) {
|
2022-06-04 15:52:56 +02:00
|
|
|
+ if (e1->k == VKINT && luaK_exp2K(fs, e1)) {
|
|
|
|
swapexps(e1, e2); /* 'e2' will be the constant operand */
|
|
|
|
flip = 1;
|
|
|
|
}
|