[MathExtras] Fix UB in minIntN
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 18 Jul 2016 17:03:09 +0000 (17:03 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 18 Jul 2016 17:03:09 +0000 (17:03 +0000)
commita2a218fbd4b15fb7af1a4e587377bd93336b5cf5
treef43fd8b155f10f0fb242b5328834c2bc99153449
parent301b1fa637ad2add819b8c0ef0495da05342d87c
[MathExtras] Fix UB in minIntN

We negated a value with a signed type which invited problems when that
value was the most negative signed number.  Use an unsigned type
for the value instead.  It will compute the same twos complement
result without the UB.

llvm-svn: 275815
llvm/include/llvm/Support/MathExtras.h