diff --git a/samples/lexed_tokens/lexed_tokens.cpp b/samples/lexed_tokens/lexed_tokens.cpp index 84632c052..111211958 100644 --- a/samples/lexed_tokens/lexed_tokens.cpp +++ b/samples/lexed_tokens/lexed_tokens.cpp @@ -12,6 +12,7 @@ #include #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Include Wave itself @@ -42,15 +43,17 @@ operator<< (std::ostream &stream, << left << boost::wave::get_token_name(id) << " (" << "#" << setw(3) << BASEID_FROM_TOKEN(id); - if (ExtTokenTypeMask & id) { - // this is an extended token id - if (AltTokenType == (id & ExtTokenOnlyMask)) { + using tokid_t = std::underlying_type::type; + if (static_cast(ExtTokenTypeMask) & static_cast(id)) { + // this is an extended token id + tokid_t ext_id = static_cast(id) & static_cast(ExtTokenOnlyMask); + if (AltTokenType == ext_id) { stream << ", AltTokenType"; } - else if (TriGraphTokenType == (id & ExtTokenOnlyMask)) { + else if (TriGraphTokenType == ext_id) { stream << ", TriGraphTokenType"; } - else if (AltExtTokenType == (id & ExtTokenOnlyMask)){ + else if (AltExtTokenType == ext_id) { stream << ", AltExtTokenType"; } } diff --git a/samples/real_positions/real_positions.cpp b/samples/real_positions/real_positions.cpp index 3039af3c6..0728a6f04 100644 --- a/samples/real_positions/real_positions.cpp +++ b/samples/real_positions/real_positions.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include /////////////////////////////////////////////////////////////////////////////// // Include Wave itself @@ -48,15 +48,17 @@ operator<< (std::ostream &stream, lex_token const &t) << left << boost::wave::get_token_name(id) << " (" << "#" << setw(3) << BASEID_FROM_TOKEN(id); - if (ExtTokenTypeMask & id) { - // this is an extended token id - if (AltTokenType == (id & ExtTokenOnlyMask)) { + using tokid_t = std::underlying_type::type; + if (static_cast(ExtTokenTypeMask) & static_cast(id)) { + // this is an extended token id + tokid_t ext_id = static_cast(id) & static_cast(ExtTokenOnlyMask); + if (AltTokenType == ext_id) { stream << ", AltTokenType"; } - else if (TriGraphTokenType == (id & ExtTokenOnlyMask)) { + else if (TriGraphTokenType == ext_id) { stream << ", TriGraphTokenType"; } - else if (AltExtTokenType == (id & ExtTokenOnlyMask)){ + else if (AltExtTokenType == ext_id) { stream << ", AltExtTokenType"; } }