summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-24 23:42:47 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-24 23:42:47 +0000
commit790631ff2d22e74cd35d8326c401f6114c357f59 (patch)
tree2083b3b5be29f0977e9bde7b37ced401a352cffd
parentcf3a678d40539278394befaea9016466c9c44621 (diff)
downloadbcm5719-llvm-790631ff2d22e74cd35d8326c401f6114c357f59.tar.gz
bcm5719-llvm-790631ff2d22e74cd35d8326c401f6114c357f59.zip
In the getBitsSet function, don't optimize for a common case that is
already covered by getLowBitsSet (i.e. when loBits==0). Consequently, remove the default value for loBits and reorder the arguments to the more natural loBits, hiBits order. This makes it more clear that this function is for bit groups in the middle of the bit width and not towards one end or the other. llvm-svn: 35312
-rw-r--r--llvm/include/llvm/ADT/APInt.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index fb6246d0084..b524b56e9b4 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -336,18 +336,16 @@ public:
/// less than loBit then the set bits "wrap". For example, with
/// parameters (32, 3, 28), you would get 0xF000000F.
/// @param numBits the intended bit width of the result
- /// @param hiBit the index of the highest bit set.
/// @param loBit the index of the lowest bit set.
+ /// @param hiBit the index of the highest bit set.
/// @returns An APInt value with the requested bits set.
/// @brief Get a value with a block of bits set.
- static APInt getBitsSet(uint32_t numBits, uint32_t hiBit, uint32_t loBit = 0){
+ static APInt getBitsSet(uint32_t numBits, uint32_t loBit, uint32_t hiBit) {
assert(hiBit < numBits && "hiBit out of range");
assert(loBit < numBits && "loBit out of range");
if (hiBit < loBit)
return getLowBitsSet(numBits, hiBit+1) |
getHighBitsSet(numBits, numBits-loBit+1);
- else if (loBit == 0)
- return getLowBitsSet(numBits, hiBit+1);
return getLowBitsSet(numBits, hiBit-loBit+1).shl(loBit);
}
OpenPOWER on IntegriCloud