From d46b1a395b0b97efda0ca5697ff5d1b45944b744 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 23 Nov 2004 10:04:34 +0000 Subject: [PATCH] Fixed a bug in code generation for left shifts git-svn-id: svn://svn.cc65.org/cc65/trunk@3296 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/shiftexpr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cc65/shiftexpr.c b/src/cc65/shiftexpr.c index 7e68656ad..2a5da3b9c 100644 --- a/src/cc65/shiftexpr.c +++ b/src/cc65/shiftexpr.c @@ -173,13 +173,13 @@ void ShiftExpr (struct ExprDesc* Expr) goto Next; } - /* If we're shifting an integer or unsigned to the left, the + /* If we're shifting an integer or unsigned to the right, the * lhs has a const address, and the shift count is larger than 8, * we can load just the high byte as a char with the correct * signedness, and reduce the shift count by 8. If the remaining * shift count is zero, we're done. */ - if (Tok == TOK_SHL && + if (Tok == TOK_SHR && IsTypeInt (Expr->Type) && ED_IsLVal (Expr) && (ED_IsLocConst (Expr) || ED_IsLocStack (Expr)) && @@ -204,7 +204,7 @@ void ShiftExpr (struct ExprDesc* Expr) /* Remove the generated load code */ RemoveCode (&Mark1); - /* Generate again code for the load */ + /* Generate again code for the load, this time with the new type */ LoadExpr (CF_NONE, Expr); /* Reset the type */ @@ -216,7 +216,7 @@ void ShiftExpr (struct ExprDesc* Expr) goto MakeRVal; } } - + } /* Generate code */ -- 2.39.5