[llvm] r217637 - [Support][Endian] Overload += and -=

Rui Ueyama ruiu at google.com
Thu Sep 11 15:55:25 PDT 2014


Author: ruiu
Date: Thu Sep 11 17:55:25 2014
New Revision: 217637

URL: http://llvm.org/viewvc/llvm-project?rev=217637&view=rev
Log:
[Support][Endian] Overload += and -=

This patch is to overload operator+= and operator-= for
{u}{little}{big}{16,32,64}_t.


Modified:
    llvm/trunk/include/llvm/Support/Endian.h

Modified: llvm/trunk/include/llvm/Support/Endian.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Endian.h?rev=217637&r1=217636&r2=217637&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Endian.h (original)
+++ llvm/trunk/include/llvm/Support/Endian.h Thu Sep 11 17:55:25 2014
@@ -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;





More information about the llvm-commits mailing list