diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /include/llvm/ADT/APInt.h | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'include/llvm/ADT/APInt.h')
| -rw-r--r-- | include/llvm/ADT/APInt.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index a1cce6e5fe17..c81363cc16b7 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -1724,13 +1724,13 @@ public: /// @{ /// \returns the floor log base 2 of this APInt. - unsigned logBase2() const { return BitWidth - 1 - countLeadingZeros(); } + unsigned logBase2() const { return getActiveBits() - 1; } /// \returns the ceil log base 2 of this APInt. unsigned ceilLogBase2() const { APInt temp(*this); --temp; - return BitWidth - temp.countLeadingZeros(); + return temp.getActiveBits(); } /// \returns the nearest log base 2 of this APInt. Ties round up. |
