# HG changeset patch
# User t_mrc-ct@users.sourceforge.jp
# Date 1372083202 -32400
# Branch GECKO1708esr_2013080515_RELBRANCH
# Node ID cb4a88ee7534db1c3d3c07bf9976536207f68691
# Parent  9ffe8b36d4ab0c78072460c3d9c64c7311b94c17
fix bad endian swap

diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1045,7 +1045,7 @@
 #endif
 }
 
-static inline double
+static inline uint64_t
 SwapBytes(uint64_t u)
 {
 #ifdef IS_BIG_ENDIAN
@@ -1058,7 +1058,7 @@
          ((u & 0x00ff000000000000LLU) >> 40) |
          ((u & 0xff00000000000000LLU) >> 56);
 #else
-  return double(u);
+  return u;
 #endif
 }
 
@@ -2643,7 +2643,8 @@
         uint64_t u;
       } pun;
     
-      pun.d = SwapBytes(static_cast<uint64_t>(autoIncrementNum));
+      pun.d = static_cast<double>(static_cast<uint64_t>(autoIncrementNum));
+      pun.u = SwapBytes(pun.u);
 
       JSAutoStructuredCloneBuffer& buffer = mCloneWriteInfo.mCloneBuffer;
       uint64_t offsetToKeyProp = mCloneWriteInfo.mOffsetToKeyProp;
