mirror of
https://github.com/cc65/cc65.git
synced 2025-01-28 15:31:18 +00:00
Avoided unnecessarily boosting the code label numbers with boolean AND.
This commit is contained in:
parent
0482e4d6e4
commit
86ced2bd4c
@ -3237,8 +3237,8 @@ static int hieAnd (ExprDesc* Expr, unsigned* TrueLab, int* TrueLabAllocated)
|
|||||||
int HasFalseJump = 0, HasTrueJump = 0;
|
int HasFalseJump = 0, HasTrueJump = 0;
|
||||||
CodeMark Start;
|
CodeMark Start;
|
||||||
|
|
||||||
/* Get a label that we will use for false expressions */
|
/* The label that we will use for false expressions */
|
||||||
int FalseLab = GetLocalLabel ();
|
int FalseLab = 0;
|
||||||
|
|
||||||
/* Get lhs */
|
/* Get lhs */
|
||||||
GetCodePos (&Start);
|
GetCodePos (&Start);
|
||||||
@ -3266,8 +3266,12 @@ static int hieAnd (ExprDesc* Expr, unsigned* TrueLab, int* TrueLabAllocated)
|
|||||||
/* Clear the test flag */
|
/* Clear the test flag */
|
||||||
ED_RequireNoTest (Expr);
|
ED_RequireNoTest (Expr);
|
||||||
|
|
||||||
|
if (HasFalseJump == 0) {
|
||||||
/* Remember that the jump is used */
|
/* Remember that the jump is used */
|
||||||
HasFalseJump = 1;
|
HasFalseJump = 1;
|
||||||
|
/* Get a label for false expressions */
|
||||||
|
FalseLab = GetLocalLabel ();
|
||||||
|
}
|
||||||
|
|
||||||
/* Generate the jump */
|
/* Generate the jump */
|
||||||
g_falsejump (CF_NONE, FalseLab);
|
g_falsejump (CF_NONE, FalseLab);
|
||||||
@ -3304,7 +3308,12 @@ static int hieAnd (ExprDesc* Expr, unsigned* TrueLab, int* TrueLabAllocated)
|
|||||||
|
|
||||||
/* Do short circuit evaluation */
|
/* Do short circuit evaluation */
|
||||||
if (CurTok.Tok == TOK_BOOL_AND) {
|
if (CurTok.Tok == TOK_BOOL_AND) {
|
||||||
|
if (HasFalseJump == 0) {
|
||||||
|
/* Remember that the jump is used */
|
||||||
HasFalseJump = 1;
|
HasFalseJump = 1;
|
||||||
|
/* Get a label for false expressions */
|
||||||
|
FalseLab = GetLocalLabel ();
|
||||||
|
}
|
||||||
g_falsejump (CF_NONE, FalseLab);
|
g_falsejump (CF_NONE, FalseLab);
|
||||||
} else {
|
} else {
|
||||||
/* We need the true label for the last expression */
|
/* We need the true label for the last expression */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user