From 96b46beee0cecc6ebfaffb6525974919748718bb Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 20 Oct 2009 08:21:12 +0000 Subject: [PATCH] Fixed a problem with bit-fields: Values spanning more than a byte must always be loaded as an int. This was not the case if the expression rhs was a char. git-svn-id: svn://svn.cc65.org/cc65/trunk@4382 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/loadexpr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cc65/loadexpr.c b/src/cc65/loadexpr.c index fd09a4d7f..4802dbb2b 100644 --- a/src/cc65/loadexpr.c +++ b/src/cc65/loadexpr.c @@ -100,8 +100,9 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) * throw away the high byte anyway and may therefore load just the * low byte. */ - if (ED_IsBitField (Expr) && Expr->BitOffs + Expr->BitWidth <= CHAR_BITS) { - Flags |= CF_CHAR | CF_UNSIGNED; + if (ED_IsBitField (Expr)) { + Flags |= (Expr->BitOffs + Expr->BitWidth <= CHAR_BITS)? CF_CHAR : CF_INT; + Flags |= CF_UNSIGNED; } else { Flags |= TypeOf (Expr->Type); } -- 2.39.5