report_fatal_error("Don't know how to emit this value.");
// We couldn't handle the requested integer size so we fallback by breaking
- // the request down into several, smaller, integers. Since sizes greater
- // than eight are invalid and size equivalent to eight should have been
- // handled earlier, we use four bytes as our largest piece of granularity.
+ // the request down into several, smaller, integers.
+ // Since sizes greater or equal to "Size" are invalid, we use the greatest
+ // power of 2 that is less than "Size" as our largest piece of granularity.
bool IsLittleEndian = MAI->isLittleEndian();
for (unsigned Emitted = 0; Emitted != Size;) {
unsigned Remaining = Size - Emitted;
// The size of our partial emission must be a power of two less than
- // eight.
- unsigned EmissionSize = PowerOf2Floor(Remaining);
- if (EmissionSize > 4)
- EmissionSize = 4;
+ // Size.
+ unsigned EmissionSize = PowerOf2Floor(std::min(Remaining, Size - 1));
// Calculate the byte offset of our partial emission taking into account
// the endianness of the target.
unsigned ByteOffset =