mirror of
https://github.com/cc65/cc65.git
synced 2024-07-05 06:28:57 +00:00
Masking a bit field is unnecessary if there was no shift operation or if the
shift operation shifted just zeroes into the value. git-svn-id: svn://svn.cc65.org/cc65/trunk@5412 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
772d51aa5e
commit
66f1f82943
@ -162,8 +162,11 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr)
|
|||||||
unsigned F = CF_INT | CF_UNSIGNED | CF_CONST | (Flags & CF_TEST);
|
unsigned F = CF_INT | CF_UNSIGNED | CF_CONST | (Flags & CF_TEST);
|
||||||
/* Shift right by the bit offset */
|
/* Shift right by the bit offset */
|
||||||
g_asr (F, Expr->BitOffs);
|
g_asr (F, Expr->BitOffs);
|
||||||
/* And by the width */
|
/* And by the width if the field doesn't end on an int boundary */
|
||||||
g_and (F, (0x0001U << Expr->BitWidth) - 1U);
|
if (Expr->BitOffs + Expr->BitWidth != CHAR_BITS &&
|
||||||
|
Expr->BitOffs + Expr->BitWidth != INT_BITS) {
|
||||||
|
g_and (F, (0x0001U << Expr->BitWidth) - 1U);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expression was tested */
|
/* Expression was tested */
|
||||||
|
Loading…
Reference in New Issue
Block a user