From 4afc552e1747102f7c5e40755170002edea54eec Mon Sep 17 00:00:00 2001 From: Jesse Rosenstock Date: Fri, 19 Jun 2020 09:06:52 +0200 Subject: [PATCH] ParseStructDecl: Make BitOffs unsigned This makes it consistent with SymEntry and removes the need for some casts that were added to avoid warnings about signed vs unsigned comparison. --- src/cc65/declare.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 35ce5d0b2..523aac48a 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -714,7 +714,7 @@ static SymEntry* ParseStructDecl (const char* Name) unsigned StructSize; int FlexibleMember; - int BitOffs; /* Bit offset for bit-fields */ + unsigned BitOffs; /* Bit offset for bit-fields */ int FieldWidth; /* Width in bits, -1 if not a bit-field */ SymTable* FieldTab; @@ -770,7 +770,7 @@ static SymEntry* ParseStructDecl (const char* Name) ** a member with an anonymous name. */ if (BitOffs > 0) { - if (FieldWidth <= 0 || (BitOffs + FieldWidth) > (int) INT_BITS) { + if (FieldWidth <= 0 || (BitOffs + FieldWidth) > INT_BITS) { /* We need an anonymous name */ AnonName (Ident, "bit-field"); @@ -839,7 +839,7 @@ static SymEntry* ParseStructDecl (const char* Name) unsigned Offs = StructSize + (BitOffs / CHAR_BITS); AddBitField (Decl.Ident, Offs, BitOffs % CHAR_BITS, FieldWidth); BitOffs += FieldWidth; - CHECK (BitOffs <= (int) INT_BITS); + CHECK (BitOffs <= INT_BITS); if (BitOffs == INT_BITS) { StructSize += SIZEOF_INT; BitOffs = 0;