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)
commit86ac44744a0207fea281fc2267fffaa69660fc03
treeb2061f060822dd06e933c96c25d25b0645a2c780
parentbccb773ebc005cc1456b37f6c9e9d634efe46312
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

llvm-svn: 235699
llvm/lib/Support/APInt.cpp
llvm/unittests/ADT/APIntTest.cpp