[APInt] Fix implicit truncation warning in bitsToFloat(). NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 6 Nov 2019 12:29:43 +0000 (12:29 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 6 Nov 2019 12:30:04 +0000 (12:30 +0000)
llvm/include/llvm/ADT/APInt.h

index 07b2e80099e64d96d280a1d7ca88c336ed89f2e9..6e611ad3fd3226f443fc14c5d7065faf9a619637 100644 (file)
@@ -1727,13 +1727,13 @@ public:
     return BitsToDouble(getWord(0));
   }
 
-  /// Converts APInt bits to a double
+  /// Converts APInt bits to a float
   ///
   /// The conversion does not do a translation from integer to float, it just
   /// re-interprets the bits as a float. Note that it is valid to do this on
   /// any bit width. Exactly 32 bits will be translated.
   float bitsToFloat() const {
-    return BitsToFloat(getWord(0));
+    return BitsToFloat(static_cast<uint32_t>(getWord(0)));
   }
 
   /// Converts a double to APInt bits.