Skip to content

Commit

Permalink
In x86: Fixed backward compatibility with C90 (#1969)
Browse files Browse the repository at this point in the history
* In x86: fixed backward compatibility with C90

* Refact: define variables as empty, do calculations only after the check passed

* Removed extra spaces
  • Loading branch information
hasherezade authored Mar 10, 2023
1 parent 61cdc56 commit def06c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions MCRegisterInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,16 @@ const MCRegisterClass* MCRegisterInfo_getRegClass(const MCRegisterInfo *RI, unsi

bool MCRegisterClass_contains(const MCRegisterClass *c, unsigned Reg)
{
unsigned InByte = 0;
unsigned Byte = 0;

// Make sure that MCRegisterInfo_getRegClass didn't return 0
// (for calls to GETREGCLASS_CONTAIN0)
if(!c)
return false;

unsigned InByte = Reg % 8;
unsigned Byte = Reg / 8;
InByte = Reg % 8;
Byte = Reg / 8;

if (Byte >= c->RegSetSize)
return false;
Expand Down

0 comments on commit def06c3

Please sign in to comment.