Fix APInt long division algorithm
authorPawel Bylica <chfast@gmail.com>
Fri, 24 Apr 2015 07:38:39 +0000 (07:38 +0000)
committerPawel Bylica <chfast@gmail.com>
Fri, 24 Apr 2015 07:38:39 +0000 (07:38 +0000)
commit9ee9f1a3342bccbb1c135abe1efc9fb6c57d4b4f
tree99c147c5162af3ee35b875d4520f70ae819095c6
parenta9a01d987969f65404d5c2869961916a7b26eb3e
Fix APInt long division algorithm

Summary: This patch fixes step D4 of Knuth's division algorithm implementation. Negative sign of the step result was not always detected due to incorrect "borrow" handling.

Test Plan: Unit test that reveals the bug included.

Reviewers: chandlerc, yaron.keren

Reviewed By: yaron.keren

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D9196

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