Fix clearUnusedBits to not depend on "undefined behavior" of >> operator
authorReid Spencer <rspencer@reidspencer.com>
Sun, 25 Feb 2007 19:26:01 +0000 (19:26 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sun, 25 Feb 2007 19:26:01 +0000 (19:26 +0000)
commitc68c2243dcb716bc117f41aa543ca8a41046df41
treec0815024cb9479fc19a320483ed5c70d0173a880
parent1fa3d9ef93578970b2e0506104b96c3ffaa42bcf
Fix clearUnusedBits to not depend on "undefined behavior" of >> operator
when the bit size is equal to the word size. This happens to work out okay
on x86, but might not on other platforms. The change just detects when
there are no bits to clear (because BitWidth is a multiple of the word size)
and returns early.

Also, move some comments from .cpp file into header.

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