Ensure -mcpu=xscale works for arm targets, after rL252903 and rL252904
[oota-llvm.git] / include / llvm / Support / SwapByteOrder.h
index 9c5a3c59122ea387e7b65f20c2e8346c141af5f1..7761fa1d7e01499045b494aa4679da7aa2dff989 100644 (file)
@@ -94,6 +94,26 @@ inline signed long long getSwappedBytes(signed long long C) {
   return SwapByteOrder_64(C);
 }
 
+inline float getSwappedBytes(float C) {
+  union {
+    uint32_t i;
+    float f;
+  } in, out;
+  in.f = C;
+  out.i = SwapByteOrder_32(in.i);
+  return out.f;
+}
+
+inline double getSwappedBytes(double C) {
+  union {
+    uint64_t i;
+    double d;
+  } in, out;
+  in.d = C;
+  out.i = SwapByteOrder_64(in.i);
+  return out.d;
+}
+
 template<typename T>
 inline void swapByteOrder(T &Value) {
   Value = getSwappedBytes(Value);