mirror of
https://github.com/cc65/cc65.git
synced 2025-01-27 09:33:42 +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;
|
||||
CodeMark Start;
|
||||
|
||||
/* Get a label that we will use for false expressions */
|
||||
int FalseLab = GetLocalLabel ();
|
||||
/* The label that we will use for false expressions */
|
||||
int FalseLab = 0;
|
||||
|
||||
/* Get lhs */
|
||||
GetCodePos (&Start);
|
||||
@ -3266,8 +3266,12 @@ static int hieAnd (ExprDesc* Expr, unsigned* TrueLab, int* TrueLabAllocated)
|
||||
/* Clear the test flag */
|
||||
ED_RequireNoTest (Expr);
|
||||
|
||||
if (HasFalseJump == 0) {
|
||||
/* Remember that the jump is used */
|
||||
HasFalseJump = 1;
|
||||
/* Get a label for false expressions */
|
||||
FalseLab = GetLocalLabel ();
|
||||
}
|
||||
|
||||
/* Generate the jump */
|
||||
g_falsejump (CF_NONE, FalseLab);
|
||||
@ -3304,7 +3308,12 @@ static int hieAnd (ExprDesc* Expr, unsigned* TrueLab, int* TrueLabAllocated)
|
||||
|
||||
/* Do short circuit evaluation */
|
||||
if (CurTok.Tok == TOK_BOOL_AND) {
|
||||
if (HasFalseJump == 0) {
|
||||
/* Remember that the jump is used */
|
||||
HasFalseJump = 1;
|
||||
/* Get a label for false expressions */
|
||||
FalseLab = GetLocalLabel ();
|
||||
}
|
||||
g_falsejump (CF_NONE, FalseLab);
|
||||
} else {
|
||||
/* We need the true label for the last expression */
|
||||
|
Loading…
x
Reference in New Issue
Block a user