Ignore:
Timestamp:
May 22, 2019, 1:00:28 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
3f840e3
Parents:
ca8704f
Message:

Started implementing the print visitor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Bitfield.hpp

    rca8704f r461046f  
    5757};
    5858
    59 /// Adds default printing operator to a bitfield type.
    60 /// Include in definition to add print function, requires other bitfield operators.
    61 /// @param N  Number of bits in bitfield
    62 #define MakeBitfieldPrint( N ) \
    63         static const char* Names[]; \
    64  \
    65         void print( std::ostream & os ) const { \
    66                 if ( (*this).any() ) { \
    67                         for ( unsigned int i = 0; i < N; i += 1 ) { \
    68                                 if ( (*this)[i] ) { \
    69                                         os << Names[i] << ' '; \
    70                                 } \
    71                         } \
    72                 } \
    73         }
     59template<typename T>
     60inline bool operator== ( const bitfield<T> & a, const bitfield<T> & b ) {
     61        return a.val == b.val;
     62}
     63
     64template<typename T>
     65inline bool operator!= ( const bitfield<T> & a, const bitfield<T> & b ) {
     66        return !(a == b);
     67}
    7468
    7569// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.