Author: void Date: Wed Jan 16 12:49:47 2008 New Revision: 46077 URL: http://llvm.org/viewvc/llvm-project?rev=46077&view=rev Log: Use the big endian check already in llvm/System/Host.h.
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=46077&r1=46076&r2=46077&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jan 16 12:49:47 2008 @@ -36,6 +36,7 @@ #include "llvm/Module.h" #include "llvm/ParameterAttributes.h" #include "llvm/Analysis/ConstantFolding.h" +#include "llvm/System/Host.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" @@ -5466,14 +5467,6 @@ double V; }; if (Ty==Type::FloatTy || Ty==Type::DoubleTy) { - // Determine endianness of host machine. - union { - int x; - char y[sizeof(int)]; - } u; - u.x = 1; - bool BigEndian = (u.y[0] != 1); - REAL_VALUE_TO_TARGET_DOUBLE(TREE_REAL_CST(exp), RealArr); // Here's how this works: @@ -5495,7 +5488,7 @@ UArr[0] = RealArr[0]; // Long -> int convert UArr[1] = RealArr[1]; - if (BigEndian != FLOAT_WORDS_BIG_ENDIAN) + if (llvm::sys::bigEndianHost() != FLOAT_WORDS_BIG_ENDIAN) std::swap(UArr[0], UArr[1]); return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat((float)V) _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits