In x86: Fixed backward compatibility with C90 (#1969)

* In x86: fixed backward compatibility with C90

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

* Removed extra spaces
This commit is contained in:
hasherezade 2023-03-10 01:37:47 +01:00 committed by GitHub
parent 61cdc56159
commit def06c3831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;