uint32_t offset = *offset_ptr;
if (de->isValidOffsetForDataOfSize(offset, sizeof(val))) {
std::memcpy(&val, &Data[offset], sizeof(val));
- if (sys::isLittleEndianHost() != isLittleEndian)
- val = sys::SwapByteOrder(val);
+ if (sys::IsLittleEndianHost != isLittleEndian)
+ sys::swapByteOrder(val);
// Advance the offset
*offset_ptr += sizeof(val);
// success
return dst;
}
- return NULL;
+ return nullptr;
}
uint8_t DataExtractor::getU8(uint32_t *offset_ptr) const {
uint32_t *DataExtractor::getU32(uint32_t *offset_ptr, uint32_t *dst,
uint32_t count) const {
return getUs<uint32_t>(offset_ptr, dst, count, this, IsLittleEndian,
- Data.data());;
+ Data.data());
}
uint64_t DataExtractor::getU64(uint32_t *offset_ptr) const {
*offset_ptr = pos + 1;
return Data.data() + offset;
}
- return NULL;
+ return nullptr;
}
uint64_t DataExtractor::getULEB128(uint32_t *offset_ptr) const {
while (isValidOffset(offset)) {
byte = Data[offset++];
- result |= (byte & 0x7f) << shift;
+ result |= uint64_t(byte & 0x7f) << shift;
shift += 7;
if ((byte & 0x80) == 0)
break;
while (isValidOffset(offset)) {
byte = Data[offset++];
- result |= (byte & 0x7f) << shift;
+ result |= uint64_t(byte & 0x7f) << shift;
shift += 7;
if ((byte & 0x80) == 0)
break;
// Sign bit of byte is 2nd high order bit (0x40)
if (shift < 64 && (byte & 0x40))
- result |= -(1 << shift);
+ result |= -(1ULL << shift);
*offset_ptr = offset;
return result;