[Support][Endian] Overload += and -=
authorRui Ueyama <ruiu@google.com>
Thu, 11 Sep 2014 22:55:25 +0000 (22:55 +0000)
committerRui Ueyama <ruiu@google.com>
Thu, 11 Sep 2014 22:55:25 +0000 (22:55 +0000)
This patch is to overload operator+= and operator-= for
{u}{little}{big}{16,32,64}_t.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217637 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Endian.h

index 75f3292ac4af0b4e5c02f6482528c79260a5ea0b..47b82fdc4975100ce7c91c91271116a2fc4c243d 100644 (file)
@@ -93,6 +93,16 @@ struct packed_endian_specific_integral {
       (void*)Value.buffer, newValue);
   }
 
+  packed_endian_specific_integral &operator+=(value_type newValue) {
+    *this = *this + newValue;
+    return *this;
+  }
+
+  packed_endian_specific_integral &operator-=(value_type newValue) {
+    *this = *this - newValue;
+    return *this;
+  }
+
 private:
   AlignedCharArray<PickAlignment<value_type, alignment>::value,
                    sizeof(value_type)> Value;