Changeset 2a5345b for src/BasicTypes-gen.cpp
- Timestamp:
- Jan 25, 2025, 5:59:05 PM (11 months ago)
- Branches:
- master
- Children:
- 11f92fac
- Parents:
- 1fb0a883
- File:
-
- 1 edited
-
src/BasicTypes-gen.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/BasicTypes-gen.cpp
r1fb0a883 r2a5345b 135 135 static Kind commonTypeMatrix[NUMBER_OF_BASIC_TYPES][NUMBER_OF_BASIC_TYPES]; 136 136 137 // Fangren explain shortest cost algorithm.137 // Compute the minimal conversion costs using Dijkstra's algorithm 138 138 void generateCosts( int row ) { 139 139 bool seen[NUMBER_OF_BASIC_TYPES] = { false /*, ... */ }; … … 176 176 177 177 // traverse children 178 // Fangren explain "max"178 // any conversion should have a cost of at least 1, even if between types of equal rank 179 179 int i = graph[col].left; 180 180 if ( i == -1 ) continue; // leaf … … 191 191 } // generateCosts 192 192 193 // Fangren explain this routine if you can. 193 // Note: this algorithm is not general. 194 // It relies on the specific structure of the conversion graph. 195 // When the common type is not one of the two given types, we should always have a real and a complex floating point type, 196 // in which case the common type is the next complex type ranked higher than the real type. 194 197 void generateCommonType( int row, int col ) { // row <= col 195 198 if ( costMatrix[row][col] >= 0 ) {
Note:
See TracChangeset
for help on using the changeset viewer.