1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Add a "PadTo" field to the emitULEB128Bytes method. This will pad out to the

indicated number of bytes.

llvm-svn: 101684
This commit is contained in:
Bill Wendling 2010-04-18 00:51:49 +00:00
parent c639c07492
commit 9218175b5f

View File

@ -174,13 +174,20 @@ public:
/// emitULEB128Bytes - This callback is invoked when a ULEB128 needs to be
/// written to the output stream.
void emitULEB128Bytes(uint64_t Value) {
void emitULEB128Bytes(uint64_t Value, unsigned PadTo = 0) {
do {
uint8_t Byte = Value & 0x7f;
Value >>= 7;
if (Value) Byte |= 0x80;
if (Value || PadTo != 0) Byte |= 0x80;
emitByte(Byte);
} while (Value);
if (PadTo) {
do {
uint8_t Byte = (PadTo > 1) ? 0x80 : 0x0;
emitByte(Byte);
} while (--PadTo);
}
}
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be