mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-05 08:58:30 +00:00
[NFC] Remove unused function GetHexWithFixedSize
The implementation of this function was obviously incorrect, as the result variable was never used. This led me to check if it was actually used anywhere, which came back negative. llvm-svn: 369492
This commit is contained in:
parent
dc333e6398
commit
7483005c59
@ -91,9 +91,6 @@ public:
|
||||
|
||||
size_t GetHexBytesAvail(llvm::MutableArrayRef<uint8_t> dest);
|
||||
|
||||
uint64_t GetHexWithFixedSize(uint32_t byte_size, bool little_endian,
|
||||
uint64_t fail_value);
|
||||
|
||||
size_t GetHexByteString(std::string &str);
|
||||
|
||||
size_t GetHexByteStringFixedLength(std::string &str, uint32_t nibble_length);
|
||||
@ -113,12 +110,14 @@ protected:
|
||||
m_index = UINT64_MAX;
|
||||
return false;
|
||||
}
|
||||
// For StringExtractor only
|
||||
std::string m_packet; // The string in which to extract data.
|
||||
uint64_t m_index; // When extracting data from a packet, this index
|
||||
// will march along as things get extracted. If set to
|
||||
// UINT64_MAX the end of the packet data was reached
|
||||
// when decoding information
|
||||
|
||||
/// The string in which to extract data.
|
||||
std::string m_packet;
|
||||
|
||||
/// When extracting data from a packet, this index will march along as things
|
||||
/// get extracted. If set to UINT64_MAX the end of the packet data was
|
||||
/// reached when decoding information.
|
||||
uint64_t m_index;
|
||||
};
|
||||
|
||||
#endif // utility_StringExtractor_h_
|
||||
|
@ -296,34 +296,6 @@ size_t StringExtractor::GetHexBytesAvail(llvm::MutableArrayRef<uint8_t> dest) {
|
||||
return bytes_extracted;
|
||||
}
|
||||
|
||||
// Consume ASCII hex nibble character pairs until we have decoded byte_size
|
||||
// bytes of data.
|
||||
|
||||
uint64_t StringExtractor::GetHexWithFixedSize(uint32_t byte_size,
|
||||
bool little_endian,
|
||||
uint64_t fail_value) {
|
||||
if (byte_size <= 8 && GetBytesLeft() >= byte_size * 2) {
|
||||
uint64_t result = 0;
|
||||
uint32_t i;
|
||||
if (little_endian) {
|
||||
// Little Endian
|
||||
uint32_t shift_amount;
|
||||
for (i = 0, shift_amount = 0; i < byte_size && IsGood();
|
||||
++i, shift_amount += 8) {
|
||||
result |= (static_cast<uint64_t>(GetHexU8()) << shift_amount);
|
||||
}
|
||||
} else {
|
||||
// Big Endian
|
||||
for (i = 0; i < byte_size && IsGood(); ++i) {
|
||||
result <<= 8;
|
||||
result |= GetHexU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_index = UINT64_MAX;
|
||||
return fail_value;
|
||||
}
|
||||
|
||||
size_t StringExtractor::GetHexByteString(std::string &str) {
|
||||
str.clear();
|
||||
str.reserve(GetBytesLeft() / 2);
|
||||
|
@ -281,34 +281,6 @@ size_t StdStringExtractor::GetHexBytesAvail(void *dst_void, size_t dst_len) {
|
||||
return bytes_extracted;
|
||||
}
|
||||
|
||||
// Consume ASCII hex nibble character pairs until we have decoded byte_size
|
||||
// bytes of data.
|
||||
|
||||
uint64_t StdStringExtractor::GetHexWithFixedSize(uint32_t byte_size,
|
||||
bool little_endian,
|
||||
uint64_t fail_value) {
|
||||
if (byte_size <= 8 && GetBytesLeft() >= byte_size * 2) {
|
||||
uint64_t result = 0;
|
||||
uint32_t i;
|
||||
if (little_endian) {
|
||||
// Little Endian
|
||||
uint32_t shift_amount;
|
||||
for (i = 0, shift_amount = 0; i < byte_size && IsGood();
|
||||
++i, shift_amount += 8) {
|
||||
result |= ((uint64_t)GetHexU8() << shift_amount);
|
||||
}
|
||||
} else {
|
||||
// Big Endian
|
||||
for (i = 0; i < byte_size && IsGood(); ++i) {
|
||||
result <<= 8;
|
||||
result |= GetHexU8();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_index = UINT64_MAX;
|
||||
return fail_value;
|
||||
}
|
||||
|
||||
size_t StdStringExtractor::GetHexByteString(std::string &str) {
|
||||
str.clear();
|
||||
str.reserve(GetBytesLeft() / 2);
|
||||
|
@ -83,9 +83,6 @@ public:
|
||||
|
||||
size_t GetHexBytesAvail(void *dst, size_t dst_len);
|
||||
|
||||
uint64_t GetHexWithFixedSize(uint32_t byte_size, bool little_endian,
|
||||
uint64_t fail_value);
|
||||
|
||||
size_t GetHexByteString(std::string &str);
|
||||
|
||||
size_t GetHexByteStringFixedLength(std::string &str, uint32_t nibble_length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user