Bug 869685 - Reintroduce long long support in CheckedInt - r=Waldo
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 08 May 2013 17:25:03 -0400
changeset 131299 9a8c7cd83f2293987e36b1103e07d29c0263844d
parent 131298 ae87f942ac08bca3010133ee7901ce32e52551bf
child 131300 e725c1aa589dffc580c10d59829ae3a2673285bc
push id27781
push userbjacob@mozilla.com
push dateWed, 08 May 2013 21:25:36 +0000
treeherdermozilla-inbound@e725c1aa589d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs869685
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 869685 - Reintroduce long long support in CheckedInt - r=Waldo
mfbt/CheckedInt.h
mfbt/tests/TestCheckedInt.cpp
--- a/mfbt/CheckedInt.h
+++ b/mfbt/CheckedInt.h
@@ -120,16 +120,23 @@ struct IsSupportedPass2<unsigned int>
 template<>
 struct IsSupportedPass2<long>
 { static const bool value = true; };
 
 template<>
 struct IsSupportedPass2<unsigned long>
 { static const bool value = true; };
 
+template<>
+struct IsSupportedPass2<long long>
+{ static const bool value = true; };
+
+template<>
+struct IsSupportedPass2<unsigned long long>
+{ static const bool value = true; };
 
 /*
  * Step 2: some integer-traits kind of stuff.
  */
 
 template<size_t Size, bool Signedness>
 struct StdintTypeForSizeAndSignedness
 {};
--- a/mfbt/tests/TestCheckedInt.cpp
+++ b/mfbt/tests/TestCheckedInt.cpp
@@ -418,26 +418,30 @@ void test()
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(int64_t)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(uint64_t)
 
   typedef signed char signedChar;
   typedef unsigned char unsignedChar;
   typedef unsigned short unsignedShort;
   typedef unsigned int  unsignedInt;
   typedef unsigned long unsignedLong;
+  typedef long long longLong;
+  typedef unsigned long long unsignedLongLong;
 
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(char)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(signedChar)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedChar)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(short)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedShort)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(int)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedInt)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(long)
   VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedLong)
+  VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(longLong)
+  VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedLongLong)
 
   /* Test increment/decrement operators */
 
   CheckedInt<T> x, y;
   x = one;
   y = x++;
   VERIFY(x == two);
   VERIFY(y == one);
@@ -480,16 +484,18 @@ int main()
   test<signed char>();
   test<unsigned char>();
   test<short>();
   test<unsigned short>();
   test<int>();
   test<unsigned int>();
   test<long>();
   test<unsigned long>();
+  test<long long>();
+  test<unsigned long long>();
 
   const int MIN_TYPES_TESTED = 9;
   if (gIntegerTypesTested < MIN_TYPES_TESTED) {
     std::cerr << "Only " << gIntegerTypesTested << " have been tested. "
               << "This should not be less than " << MIN_TYPES_TESTED << "."
               << std::endl;
     gTestsFailed++;
   }