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