Fix for failing test from sanitizer-x86_64-linux-fast where there was a
left shift on a negative value. llvm-svn: 339037
This commit is contained in:
parent
e98b9d4c74
commit
b30502efc3
|
@ -364,12 +364,19 @@ TEST(FixedPoint, compare) {
|
|||
void CheckUnsaturatedConversion(FixedPointSemantics Src,
|
||||
FixedPointSemantics Dst, int64_t TestVal) {
|
||||
int64_t ScaledVal = TestVal;
|
||||
bool IsNegative = ScaledVal < 0;
|
||||
if (IsNegative)
|
||||
ScaledVal = -ScaledVal;
|
||||
|
||||
if (Dst.getScale() > Src.getScale()) {
|
||||
ScaledVal <<= (Dst.getScale() - Src.getScale());
|
||||
} else {
|
||||
ScaledVal >>= (Src.getScale() - Dst.getScale());
|
||||
}
|
||||
|
||||
if (IsNegative)
|
||||
ScaledVal = -ScaledVal;
|
||||
|
||||
APFixedPoint Fixed(TestVal, Src);
|
||||
APFixedPoint Expected(ScaledVal, Dst);
|
||||
ASSERT_EQ(Fixed.convert(Dst), Expected);
|
||||
|
|
Loading…
Reference in New Issue