Bug 1354090: P2. Add operator+(val). r=gerald, a=gchang
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 07 Apr 2017 11:31:00 +0200
changeset 393485 e4322515d022f251bfcdf7506620f0bc373a9bb3
parent 393484 b8d1179d566084b1607d15ecbf6274ac1ff6f31b
child 393486 e7959171bacf399f89f7957d13a4fee300998d0b
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, gchang
bugs1354090
milestone54.0a2
Bug 1354090: P2. Add operator+(val). r=gerald, a=gchang Such that: [x, y] + a = [x+a, y+a] MozReview-Commit-ID: HlyI9KmVtTg
dom/media/Intervals.h
--- a/dom/media/Intervals.h
+++ b/dom/media/Intervals.h
@@ -96,24 +96,34 @@ public:
   // Basic interval arithmetic operator definition.
   SelfType operator+ (const SelfType& aOther) const
   {
     return SelfType(mStart + aOther.mStart,
                     mEnd + aOther.mEnd,
                     mFuzz + aOther.mFuzz);
   }
 
+  SelfType operator+ (const T& aVal) const
+  {
+    return SelfType(mStart + aVal, mEnd + aVal, mFuzz);
+  }
+
   // Basic interval arithmetic operator definition.
   SelfType operator- (const SelfType& aOther) const
   {
     return SelfType(mStart - aOther.mEnd,
                     mEnd - aOther.mStart,
                     mFuzz + aOther.mFuzz);
   }
 
+  SelfType operator- (const T& aVal) const
+  {
+    return SelfType(mStart - aVal, mEnd - aVal, mFuzz);
+  }
+
   bool operator== (const SelfType& aOther) const
   {
     return mStart == aOther.mStart && mEnd == aOther.mEnd;
   }
 
   bool operator!= (const SelfType& aOther) const
   {
     return !(*this == aOther);