Changeset 24 for branches/with_autoconf/src/sc_uint.h
- Timestamp:
- Apr 18, 2009, 4:36:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/with_autoconf/src/sc_uint.h
r20 r24 183 183 184 184 // arithmetic 185 template <typename T> 186 inline sc_uint& operator <<= (T v) 187 { vf.valW <<= v; return *this; } 188 template <typename T> 189 inline sc_uint& operator >>= (T v) 190 { vf.valW >>= v; return *this; } 191 template <typename T> 192 inline sc_uint& operator += (T v) 193 { vf.valW += v; return *this; } 194 template <typename T> 195 inline sc_uint& operator -= (T v) 196 { vf.valW -= v; return *this; } 197 template <typename T> 198 inline sc_uint& operator *= (T v) 199 { vf.valW *= v; return *this; } 200 template <typename T> 201 inline sc_uint& operator /= (T v) 202 { vf.valW /= v; return *this; } 203 template <typename T> 204 inline sc_uint& operator %= (T v) 205 { vf.valW %= v; return *this; } 206 template <typename T> 207 inline sc_uint& operator &= (T v) 208 { vf.valW &= v; return *this; } 209 template <typename T> 210 inline sc_uint& operator |= (T v) 211 { vf.valW |= v; return *this; } 212 template <typename T> 213 inline sc_uint& operator ^= (T v) 214 { vf.valW ^= v; return *this; } 185 #define DEFINE_OPERATOR(OPER) \ 186 template <typename T> \ 187 inline sc_uint& operator OPER (T v)\ 188 { vf.valW OPER v; return *this; } 189 190 DEFINE_OPERATOR(<<=) 191 DEFINE_OPERATOR(>>=) 192 DEFINE_OPERATOR(+=) 193 DEFINE_OPERATOR(-=) 194 DEFINE_OPERATOR(*=) 195 DEFINE_OPERATOR(/=) 196 DEFINE_OPERATOR(%=) 197 DEFINE_OPERATOR(&=) 198 DEFINE_OPERATOR(|=) 199 DEFINE_OPERATOR(^=) 200 #undef DEFINE_OPERATOR 201 202 #if 0 203 #define DEFINE_OPERATOR(OPER) \ 204 friend bool operator OPER (const data_type& a, const data_type& b); 205 // { return (a.valW) OPER (b.valW); } 206 207 DEFINE_OPERATOR(==) 208 DEFINE_OPERATOR(!=) 209 DEFINE_OPERATOR(>=) 210 DEFINE_OPERATOR(<=) 211 #undef DEFINE_OPERATOR 212 #endif 215 213 inline sc_uint_bit_ref operator [] (int v) 216 214 { return (vf.valW >> v) & 1; }
Note: See TracChangeset
for help on using the changeset viewer.