Author: Timm Bäder Date: 2023-11-08T09:33:37+01:00 New Revision: c468e8923cadfa4c181eaa8bdbcf8d95feb70132
URL: https://github.com/llvm/llvm-project/commit/c468e8923cadfa4c181eaa8bdbcf8d95feb70132 DIFF: https://github.com/llvm/llvm-project/commit/c468e8923cadfa4c181eaa8bdbcf8d95feb70132.diff LOG: [clang][Interp][NFC] Fix right shifting signed IntegralAP values Added: Modified: clang/lib/AST/Interp/IntegralAP.h Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/IntegralAP.h b/clang/lib/AST/Interp/IntegralAP.h index 1f535d420bcd54b..6d301bad784af47 100644 --- a/clang/lib/AST/Interp/IntegralAP.h +++ b/clang/lib/AST/Interp/IntegralAP.h @@ -248,7 +248,11 @@ template <bool Signed> class IntegralAP final { static void shiftRight(const IntegralAP A, const IntegralAP B, unsigned OpBits, IntegralAP *R) { - *R = IntegralAP(A.V.ashr(B.V.getZExtValue())); + unsigned ShiftAmount = B.V.getZExtValue(); + if constexpr (Signed) + *R = IntegralAP(A.V.ashr(ShiftAmount)); + else + *R = IntegralAP(A.V.lshr(ShiftAmount)); } private: _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits