[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp
Reid Spencer
reid at x10sys.com
Sun Feb 18 12:21:44 PST 2007
Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt:
arith.cpp updated: 1.8 -> 1.9
---
Log message:
Make use of ability to print signed values.
Fix a bug in the display of != result.
---
Diffs of the changes: (+8 -7)
arith.cpp | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
Index: llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.8 llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.9
--- llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.8 Sat Feb 17 02:18:20 2007
+++ llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp Sun Feb 18 14:21:27 2007
@@ -21,8 +21,8 @@
static std::string temp_str;
-const char* str(const APInt& X) {
- temp_str = X.toString();
+const char* str(const APInt& X, bool wantSigned = false) {
+ temp_str = X.toString(10,wantSigned);
return temp_str.c_str();
}
@@ -35,10 +35,10 @@
APInt umax(APInt::getMaxValue(bitwidth, false));
APInt smin(APInt::getMinValue(bitwidth, true));
APInt umin(APInt::getMinValue(bitwidth, false));
- printf("APInt::getMaxValue(%d, true) = %s\n", bitwidth, str(smax));
- printf("APInt::getMaxValue(%d, false) = %s\n", bitwidth, str(umax));
- printf("APInt::getMinValue(%d, true) = %s\n", bitwidth, str(smin));
+ printf("APInt::getMinValue(%d, true) = %s\n", bitwidth, str(smin,true));
+ printf("APInt::getMaxValue(%d, true) = %s\n", bitwidth, str(smax,true));
printf("APInt::getMinValue(%d, false) = %s\n", bitwidth, str(umin));
+ printf("APInt::getMaxValue(%d, false) = %s\n", bitwidth, str(umax));
APInt null = APInt::getNullValue(bitwidth);
APInt allone = APInt::getAllOnesValue(bitwidth);
printf("APInt::getNullValue(%d) = %s\n", bitwidth, str(null));
@@ -94,7 +94,8 @@
x = val.byteSwap();
printf("val.byteSwap() = %d\n", str(x));
}
- printf("val.roundToDouble(true) %d = %f\n", val.roundToDouble(true));
+ printf("val.roundToDouble(false) = %f\n", val.roundToDouble(false));
+ printf("val.roundToDouble(true) = %f\n", val.roundToDouble(true));
printf("val.getValue() = ");
if (val.getBitWidth() > 64)
printf("too wide\n");
@@ -136,7 +137,7 @@
result = v1 - v2;
printf("v1 - v2: %s\n", str(result));
printf("v1 == v2: %d\n", v1 == v2);
- printf("v1 != v2: %d\n", v1 == v2);
+ printf("v1 != v2: %d\n", v1 != v2);
printf("v1.eq(v2): %d\n", v1.eq(v2));
printf("v1.ne(v2): %d\n", v1.ne(v2));
printf("v1.ult(v2): %d\n", v1.ult(v2));
More information about the llvm-commits
mailing list