]> granicus.if.org Git - llvm/commit
[APInt] Keep the original bit width in quotient and remainder
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Thu, 19 Jul 2018 18:07:56 +0000 (18:07 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Thu, 19 Jul 2018 18:07:56 +0000 (18:07 +0000)
commit3bb52cad65ae408d80b24051fc30fdbb0c5fcb10
treebdb4b919f44a6d4ec8ce2a14e790a7b896e71335
parent5b81b48075a69e9beda4eb869dc8eb0e9d09a156
[APInt] Keep the original bit width in quotient and remainder

Some trivial cases in udivrem were handled by directly assigning 0 or 1
to APInt objects. This would set the bit width to 1, instead of the bit
width of the inputs. A potentially undesirable side effect of that is
that with the bit width of 1, 1 equals -1.

Differential Revision: https://reviews.llvm.org/D49554

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337478 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/APInt.cpp
unittests/ADT/APIntTest.cpp