[PATCH] D139683: [APInt] provide a safe API for zext value and sext value.
    Peter Rong via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Dec  8 17:05:50 PST 2022
    
    
  
Peter marked an inline comment as done.
Peter added inline comments.
================
Comment at: llvm/lib/Support/APInt.cpp:506-518
+Optional<uint64_t> APInt::tryZExtValue() const {
+  if (isSingleWord())
+    return Optional<uint64_t>(U.VAL);
+  return (getActiveBits() <= 64) ? Optional<uint64_t>(U.pVal[0])
+                                 : Optional<uint64_t>();
+}
+
----------------
lebedev.ri wrote:
> These should just check for precondition and call the normal functions
You are right, thanks for pointing that out.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139683/new/
https://reviews.llvm.org/D139683
    
    
More information about the llvm-commits
mailing list