Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CastCost.cc

    r9fd97126 r543159b  
    1010// Created On       : Sun May 17 06:57:43 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Feb  2 15:34:36 2016
    13 // Update Count     : 7
     12// Last Modified On : Sun May 17 06:59:10 2015
     13// Update Count     : 2
    1414//
    1515
     
    5656                                return Cost::infinity;
    5757                        } else {
    58                                 // xxx - why are we adding cost 0 here?
    5958                                return converter.get_cost() + Cost( 0, 0, 0 );
    6059                        } // if
     
    6968                PointerType *destAsPointer = dynamic_cast< PointerType* >( dest );
    7069                if ( destAsPointer && basicType->isInteger() ) {
    71                         // necessary for, e.g. unsigned long => void*
    7270                        cost = Cost( 1, 0, 0 );
    7371                } else {
     
    8482                                newEnv.add( pointerType->get_forall() );
    8583                                newEnv.add( pointerType->get_base()->get_forall() );
    86                                 int castResult = ptrsCastable( pointerType->get_base(), destAsPtr->get_base(), newEnv, indexer );
    87                                 if ( castResult > 0 ) {
     84                                int assignResult = ptrsCastable( pointerType->get_base(), destAsPtr->get_base(), newEnv, indexer );
     85                                if ( assignResult > 0 ) {
    8886                                        cost = Cost( 0, 0, 1 );
    89                                 } else if ( castResult < 0 ) {
    90                                         cost = Cost::infinity;
     87                                } else if ( assignResult < 0 ) {
     88                                        cost = Cost( 1, 0, 0 );
    9189                                } // if
    9290                        } // if
    9391                } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
    9492                        if ( destAsBasic->isInteger() ) {
    95                                 // necessary for, e.g. void* => unsigned long
    9693                                cost = Cost( 1, 0, 0 );
    9794                        } // if
Note: See TracChangeset for help on using the changeset viewer.