diff --git a/xpcom/string/public/nsAlgorithm.h b/xpcom/string/public/nsAlgorithm.h
index fa50194a..c5f5737 100644
--- xpcom/string/public/nsAlgorithm.h
+++ xpcom/string/public/nsAlgorithm.h
@@ -42,7 +42,8 @@ NS_MAX( const T& a, const T& b )
     return a > b ? a : b;
   }
 
-#if defined(_MSC_VER) && (_MSC_VER < 1600)
+#if (defined(_MSC_VER) && (_MSC_VER < 1600)) || \
+    (defined(_GLIBCXX_USE_LONG_LONG) && (!_GLIBCXX_USE_C99 || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC))
 namespace std {
 inline
 long long
