[PATCH] D30336: [APInt] Add APInt::extractBits() method to extract APInt subrange

Filipe Cabecinhas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 08:35:26 PST 2017


filcab added a comment.

LGTM



================
Comment at: lib/Support/APInt.cpp:640
+  if (loBit == 0)
+    return APInt(numBits, 1 + hiWord - loWord, pVal + loWord);
+
----------------
Looks deprecated
```  /// Equivalent to APInt(numBits, ArrayRef<uint64_t>(bigVal, numWords)), but
  /// deprecated because this constructor is prone to ambiguity with the
  /// APInt(unsigned, uint64_t, bool) constructor.
  ///
  /// If this overload is ever deleted, care should be taken to prevent calls
  /// from being incorrectly captured by the APInt(unsigned, uint64_t, bool)
  /// constructor.
  APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);```

Maybe `return APInt(numBits, makeArrayRef(pVal + loWord, 1 + hiWord - loWord));`?


Repository:
  rL LLVM

https://reviews.llvm.org/D30336





More information about the llvm-commits mailing list