[PATCH] D50873: [WebAssembly] v128.const

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 21 13:26:28 PDT 2018


dschuff added inline comments.


================
Comment at: lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp:95
+template <typename T>
+bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
+  if (Size + sizeof(T) > Bytes.size())
----------------
For extra fun template points you could combine this with the FP case below for a single parseImmediate, where you could add something like 
`if (std::is_floating_point<T>::value) { ... } else { ... }`
You can probably even do the conditional statically, although I'm not sure that would be more readable.


Repository:
  rL LLVM

https://reviews.llvm.org/D50873





More information about the llvm-commits mailing list