[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h

Reid Spencer reid at x10sys.com
Sat Mar 3 00:34:19 PST 2007



Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.38 -> 1.39
---
Log message:

Regularize the interface for conversion functions to/from float/double.


---
Diffs of the changes:  (+9 -3)

 APInt.h |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.38 llvm/include/llvm/ADT/APInt.h:1.39
--- llvm/include/llvm/ADT/APInt.h:1.38	Sat Mar  3 00:17:23 2007
+++ llvm/include/llvm/ADT/APInt.h	Sat Mar  3 02:34:02 2007
@@ -865,14 +865,20 @@
   return float(RoundAPIntToDouble(APIVal));
 }
 
+/// Treast the APInt as a signed value for conversion purposes.
+/// @brief Converts the given APInt to a float value.
+inline float RoundSignedAPIntToFloat(const APInt& APIVal) {
+  return float(APIVal.signedRoundToDouble());
+}
+
 /// RoundDoubleToAPInt - This function convert a double value to an APInt value.
 /// @brief Converts the given double value into a APInt.
-APInt RoundDoubleToAPInt(double Double, uint32_t width = 64);
+APInt RoundDoubleToAPInt(double Double, uint32_t width);
 
 /// RoundFloatToAPInt - Converts a float value into an APInt value.
 /// @brief Converts a float value into a APInt.
-inline APInt RoundFloatToAPInt(float Float) {
-  return RoundDoubleToAPInt(double(Float));
+inline APInt RoundFloatToAPInt(float Float, uint32_t width) {
+  return RoundDoubleToAPInt(double(Float), width);
 }
 
 /// Arithmetic right-shift the APInt by shiftAmt.






More information about the llvm-commits mailing list