Changes in directory llvm/include/llvm/ADT:
APInt.h updated: 1.41 -> 1.42 --- Log message: Add zextOrCopy() into APInt for convenience. --- Diffs of the changes: (+9 -0) APInt.h | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.41 llvm/include/llvm/ADT/APInt.h:1.42 --- llvm/include/llvm/ADT/APInt.h:1.41 Sun Mar 11 01:16:10 2007 +++ llvm/include/llvm/ADT/APInt.h Tue Mar 13 01:16:26 2007 @@ -450,6 +450,15 @@ /// @brief Zero extend or truncate to width APInt &zextOrTrunc(uint32_t width); + /// This is a help function for convenience. If the given \p width equals to + /// this APInt's BitWidth, just return this APInt, otherwise, just zero + /// extend it. + inline APInt &zextOrCopy(uint32_t width) { + if (width == BitWidth) + return *this; + return zext(width); + } + /// @brief Set every bit to 1. APInt& set(); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits