[PATCH] D44337: Make ConstantDataArray::get constructor templated. Will support signed integers.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 08:57:03 PDT 2018


asbirlea added inline comments.


================
Comment at: include/llvm/IR/Constants.h:701
+    const char *Data = reinterpret_cast<const char *>(Elts.data());
+    int noOfBytes = sizeof(ElementTy);
+    Type *Ty;
----------------
sanjoy wrote:
> I'm not sure of the rules here, but perhaps this needs to be `sizeof(ElementTy) * CHAR_BIT / 8` to be technically correct?
It made sense to add ` * CHAR_BIT` when passing no of bits to getIntNTy.
But having `no_bytes = sizeof  * CHAR_BIT / 8`, and `no bits = no_bytes *CHAR_BIT` together doesn't make sense.  I dropped the first, but I'm not clear if that's correct.


Repository:
  rL LLVM

https://reviews.llvm.org/D44337





More information about the llvm-commits mailing list