shift operation shifted just zeroes into the value.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5412
b7a2c559-68d2-44c3-8de9-
860c34a00d81
unsigned F = CF_INT | CF_UNSIGNED | CF_CONST | (Flags & CF_TEST);
/* Shift right by the bit offset */
g_asr (F, Expr->BitOffs);
- /* And by the width */
- g_and (F, (0x0001U << Expr->BitWidth) - 1U);
+ /* And by the width if the field doesn't end on an int boundary */
+ if (Expr->BitOffs + Expr->BitWidth != CHAR_BITS &&
+ Expr->BitOffs + Expr->BitWidth != INT_BITS) {
+ g_and (F, (0x0001U << Expr->BitWidth) - 1U);
+ }
}
/* Expression was tested */