simplify code
authorChris Lattner <sabre@nondot.org>
Tue, 22 May 2007 06:47:11 +0000 (06:47 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 22 May 2007 06:47:11 +0000 (06:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37280 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/Lexer.l

index 2218aa5164b8886c3d81cd2159c82d765fadb730..ed1f6bf4570595dd3500afb995a23b46c5e1035b 100644 (file)
@@ -27,6 +27,7 @@
 %{
 #include "ParserInternals.h"
 #include "llvm/Module.h"
+#include "llvm/Support/MathExtras.h"
 #include <list>
 #include "llvmAsmParser.h"
 #include <cctype>
@@ -95,17 +96,7 @@ static uint64_t HexIntToVal(const char *Buffer) {
 // point representation of it.
 //
 static double HexToFP(const char *Buffer) {
-  // Behave nicely in the face of C TBAA rules... see:
-  // http://www.nullstone.com/htmls/category/aliastyp.htm
-  union {
-    uint64_t UI;
-    double FP;
-  } UIntToFP;
-  UIntToFP.UI = HexIntToVal(Buffer);
-
-  assert(sizeof(double) == sizeof(uint64_t) &&
-         "Data sizes incompatible on this target!");
-  return UIntToFP.FP;   // Cast Hex constant to double
+  return BitsToDouble(HexIntToVal(Buffer));   // Cast Hex constant to double
 }