# HG changeset patch
# User t_mrc-ct@users.sourceforge.jp
# Date 1382968958 -32400
# Branch GECKO17011esr_2013111808_RELBRANCH
# Node ID 61dca8f6cbf6b730f3867cacb85b8c608da77e58
# Parent  da53778d1ac7439ae65ef92f4e33aa6aa24b345f
M572983 patch for PPC_OSX

diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -1256,37 +1256,39 @@
     return d > 0x7fffffffffffffffui64 ?
            uint64_t(d - 0x8000000000000000ui64) + 0x8000000000000000ui64 :
            uint64_t(d);
   }
 };
 #endif
 
 // C++ doesn't guarantee that exact values are the only ones that will
-// round-trip. In fact, on some platforms, including SPARC, there are pairs of
+// round-trip. In fact, on some platforms, including SPARC and PPC_MACOSX, there are pairs of
 // values, a uint64_t and a double, such that neither value is exactly
 // representable in the other type, but they cast to each other.
-#ifdef SPARC
+#if defined(SPARC) || defined(JS_CPU_PPC_OSX)
 // Simulate x86 overflow behavior
 template<>
 struct ConvertImpl<uint64_t, double> {
   static JS_ALWAYS_INLINE uint64_t Convert(double d) {
-    return d >= 0xffffffffffffffff ?
-           0x8000000000000000 : uint64_t(d);
+    return d >= 0xffffffffffffffffULL ?
+           0x8000000000000000ULL : uint64_t(d);
   }
 };
 
+#if defined(SPARC)
 template<>
 struct ConvertImpl<int64_t, double> {
   static JS_ALWAYS_INLINE int64_t Convert(double d) {
-    return d >= 0x7fffffffffffffff ?
-           0x8000000000000000 : int64_t(d);
+    return d >= 0x7fffffffffffffffLL ?
+           0x8000000000000000LL : int64_t(d);
   }
 };
 #endif
+#endif
 
 template<class TargetType, class FromType>
 static JS_ALWAYS_INLINE TargetType Convert(FromType d)
 {
   return ConvertImpl<TargetType, FromType>::Convert(d);
 }
 
 template<class TargetType, class FromType>
