Changes in src/ResolvExpr/CastCost.cc [9fd97126:543159b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CastCost.cc
r9fd97126 r543159b 10 10 // Created On : Sun May 17 06:57:43 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 2 15:34:36 201613 // Update Count : 712 // Last Modified On : Sun May 17 06:59:10 2015 13 // Update Count : 2 14 14 // 15 15 … … 56 56 return Cost::infinity; 57 57 } else { 58 // xxx - why are we adding cost 0 here?59 58 return converter.get_cost() + Cost( 0, 0, 0 ); 60 59 } // if … … 69 68 PointerType *destAsPointer = dynamic_cast< PointerType* >( dest ); 70 69 if ( destAsPointer && basicType->isInteger() ) { 71 // necessary for, e.g. unsigned long => void*72 70 cost = Cost( 1, 0, 0 ); 73 71 } else { … … 84 82 newEnv.add( pointerType->get_forall() ); 85 83 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 ) { 88 86 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 ); 91 89 } // if 92 90 } // if 93 91 } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) { 94 92 if ( destAsBasic->isInteger() ) { 95 // necessary for, e.g. void* => unsigned long96 93 cost = Cost( 1, 0, 0 ); 97 94 } // if
Note:
See TracChangeset
for help on using the changeset viewer.