Return the index of the largest subexpression of 'type_dag[i]' (possibly 'i' itself) that is either * (1) a 'SUM' type; * (2) a 'PRODUCT' type of two non-trivial type arguments. * * If there is no such subexpression at all, i.e. when 'type_dag[i]' is a trivial type, return 0 * (which is the index of the 'ONE' type). * * This functions is used for fast traversals of type expressions, skippin
| 76 | * as this function runs in in constant time. |
| 77 | */ |
| 78 | static inline size_t typeSkip(size_t i, const type* type_dag) { |
| 79 | if (0 == type_dag[i].bitSize) return 0; |
| 80 | if (PRODUCT == type_dag[i].kind && |
| 81 | (0 == type_dag[type_dag[i].typeArg[0]].bitSize || 0 == type_dag[type_dag[i].typeArg[1]].bitSize)) { |
| 82 | return type_dag[i].skip; |
| 83 | } |
| 84 | return i; |
| 85 | } |
| 86 | |
| 87 | /* Precondition: type type_dag[i] and 'type_dag' is well-formed. |
| 88 | * if type_dag[i] is a non-trival 'PRODUCT', then both of its two type arguments are non-trival. |
no outgoing calls
no test coverage detected