[llvm] 91487b2 - [X86][Disassembler][NFCI] Read bytes with support::endian::read
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 8 09:26:06 PST 2023
Author: Benjamin Kramer
Date: 2023-01-08T18:19:49+01:00
New Revision: 91487b2481959aba976cc24b480a4be3784d50d5
URL: https://github.com/llvm/llvm-project/commit/91487b2481959aba976cc24b480a4be3784d50d5
DIFF: https://github.com/llvm/llvm-project/commit/91487b2481959aba976cc24b480a4be3784d50d5.diff
LOG: [X86][Disassembler][NFCI] Read bytes with support::endian::read
Added:
Modified:
llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
index ed5c644d860b9..49651da63ecf9 100644
--- a/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
+++ b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp
@@ -194,10 +194,7 @@ template <typename T> static bool consume(InternalInstruction *insn, T &ptr) {
uint64_t offset = insn->readerCursor - insn->startLocation;
if (offset + sizeof(T) > r.size())
return true;
- T ret = 0;
- for (unsigned i = 0; i < sizeof(T); ++i)
- ret |= (uint64_t)r[offset + i] << (i * 8);
- ptr = ret;
+ ptr = support::endian::read<T>(&r[offset], support::little);
insn->readerCursor += sizeof(T);
return false;
}
More information about the llvm-commits
mailing list