Compute getLowBitsSet correctly. Using the complement of a 64-bit value
authorReid Spencer <rspencer@reidspencer.com>
Sun, 25 Mar 2007 21:58:42 +0000 (21:58 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sun, 25 Mar 2007 21:58:42 +0000 (21:58 +0000)
commitf6bef488eeab75b6c7746f9faa9731d45bb84aef
tree9e6ed6c2f6d7e3ceef7d1b0dac49353cdf2908b0
parent9031aca96bf83379f837e1e590dc19dd67a3fdcd
Compute getLowBitsSet correctly. Using the complement of a 64-bit value
and shifting down without regard for the bitwidth of the APInt can lead
to incorrect initialization values. Instead, check for the word size case
(to avoid undef results from shift) and then do (1 << loBitsSet) - 1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35344 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/APInt.h