We only need this for std::abs, but since we're also testing the sign of the same value, then its not really necessary.
As detailed in https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html - APInt.h is the generic header with the highest expanded size, due to the dependency on <cmath>
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <climits>
-#include <cmath>
#include <cstring>
#include <utility>
/// relative logical shift right
APInt relativeLShr(int RelativeShift) const {
- int Shift = std::abs(RelativeShift);
- return RelativeShift > 0 ? lshr(Shift) : shl(Shift);
+ return RelativeShift > 0 ? lshr(RelativeShift) : shl(-RelativeShift);
}
/// relative logical shift left
/// relative arithmetic shift right
APInt relativeAShr(int RelativeShift) const {
- int Shift = std::abs(RelativeShift);
- return RelativeShift > 0 ? ashr(Shift) : shl(Shift);
+ return RelativeShift > 0 ? ashr(RelativeShift) : shl(-RelativeShift);
}
/// relative arithmetic shift left