Browse Source

Add operator<< for RegAS

We already supported operator*, and operator<<(x) is just the same
as operator*(1<<x).
Ian Goldberg 5 months ago
parent
commit
42eb384dcd
1 changed files with 11 additions and 0 deletions
  1. 11 0
      types.hpp

+ 11 - 0
types.hpp

@@ -101,6 +101,17 @@ struct RegAS {
         return res;
     }
 
+    inline RegAS &operator<<=(nbits_t shift) {
+        this->ashare <<= shift;
+        return *this;
+    }
+
+    inline RegAS operator<<(nbits_t shift) const {
+        RegAS res = *this;
+        res <<= shift;
+        return res;
+    }
+
     // Multiply a scalar by a vector
     template <size_t N>
     inline std::array<RegAS,N> operator*(std::array<value_t,N> rhs) const {