"unsigned long" can be 8 bytes, but the code assumes 4.
This this the real root cause D122215 was reverted.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D144316
SmallVector<unsigned, 4> Bits;
public:
- void addInteger(unsigned long I) { Bits.push_back(I); }
+ void addInteger(unsigned long I) {
+ if (sizeof(long) == sizeof(int))
+ addInteger(unsigned(I));
+ else if (sizeof(long) == sizeof(long long))
+ addInteger((unsigned long long)I);
+ else
+ llvm_unreachable("unexpected sizeof(long)");
+ }
void addInteger(unsigned I) { Bits.push_back(I); }
void addInteger(int I) { Bits.push_back(I); }