Skip to content

Commit b6ecd61

Browse files
author
Benoit Jacob
committed
Bug 869685 - Reintroduce long long support in CheckedInt - r=Waldo
1 parent 66bbecc commit b6ecd61

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

mfbt/CheckedInt.h

+7
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ template<>
125125
struct IsSupportedPass2<unsigned long>
126126
{ static const bool value = true; };
127127

128+
template<>
129+
struct IsSupportedPass2<long long>
130+
{ static const bool value = true; };
131+
132+
template<>
133+
struct IsSupportedPass2<unsigned long long>
134+
{ static const bool value = true; };
128135

129136
/*
130137
* Step 2: some integer-traits kind of stuff.

mfbt/tests/TestCheckedInt.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ void test()
423423
typedef unsigned short unsignedShort;
424424
typedef unsigned int unsignedInt;
425425
typedef unsigned long unsignedLong;
426+
typedef long long longLong;
427+
typedef unsigned long long unsignedLongLong;
426428

427429
VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(char)
428430
VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(signedChar)
@@ -433,6 +435,8 @@ void test()
433435
VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedInt)
434436
VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(long)
435437
VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedLong)
438+
VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(longLong)
439+
VERIFY_CONSTRUCTION_FROM_INTEGER_TYPE(unsignedLongLong)
436440

437441
/* Test increment/decrement operators */
438442

@@ -485,6 +489,8 @@ int main()
485489
test<unsigned int>();
486490
test<long>();
487491
test<unsigned long>();
492+
test<long long>();
493+
test<unsigned long long>();
488494

489495
const int MIN_TYPES_TESTED = 9;
490496
if (gIntegerTypesTested < MIN_TYPES_TESTED) {

0 commit comments

Comments
 (0)