Exemplo n.º 1
0
int IsSameUnqualifiedType(const Type *aType, const Type *bType)
{
    const int UnQMask = TYPE_BASE_MASK | TYPE_CATEGORY_MASK ; // 020122 // | TYPE_DOMAIN_MASK;

    if (aType == bType) {
        return 1;
    } else {
        if ((aType->properties & UnQMask) == (bType->properties & UnQMask)) {
            switch (aType->properties & TYPE_CATEGORY_MASK) {
            case TYPE_CATEGORY_SCALAR:
                return 1;
            case TYPE_CATEGORY_ARRAY:
                if (aType->arr.numels == bType->arr.numels) {
                    // Should we check for Packed here??? I think so!
                    return IsSameUnqualifiedType(aType->arr.eltype, bType->arr.eltype);
                }
                break;
            case TYPE_CATEGORY_FUNCTION:
                break;
            case TYPE_CATEGORY_STRUCT:
                if (aType->str.unqualifiedtype == bType->str.unqualifiedtype)
                    return 1;
            default:
                break;
            }
        }
    }
    return 0;
} // IsSameUnqualifiedType
Exemplo n.º 2
0
bool IsSameUnqualifiedType(const Type *aType, const Type *bType)
{
  //const int UnQMask = TB_MASK | TC_MASK ; // 020122 // | TD_MASK;
  
  if (aType == bType) {
    return 1;
  } else {
    if ( aType->base == bType->base && aType->category == bType->category ) {
      // }&& aType->qualifier == bType->qualifier ) { // Why was I checking qualifier for unqualified compare?
      switch ( aType->category ) {
        case TC_Scalar:
          return true;
        case TC_Array:
				{
					const TypeArray * a = static_cast< const TypeArray * >( aType );
					const TypeArray * b = static_cast< const TypeArray * >( bType );
					if ( a->numels == b->numels) {
						// Should we check for Packed here??? I think so!
						return IsSameUnqualifiedType( a->eltype, b->eltype);
					}
				}
          break;
        case TC_Function:
          break;
        case TC_Struct:
				{
					const TypeStruct * a = static_cast< const TypeStruct * >( aType );
					const TypeStruct * b = static_cast< const TypeStruct * >( bType );
					if ( a->unqualifiedtype == b->unqualifiedtype ) {
						return true;
					}
				}
        default:
          break;
      }
    }
  }
  return false;
} // IsSameUnqualifiedType