| 82 | } |
| 83 | |
| 84 | static void |
| 85 | size_classes( |
| 86 | /* Output. */ |
| 87 | sc_data_t *sc_data, |
| 88 | /* Determined by the system. */ |
| 89 | size_t lg_ptr_size, int lg_quantum, |
| 90 | /* Configuration decisions. */ |
| 91 | int lg_tiny_min, int lg_max_lookup, int lg_page, int lg_ngroup) { |
| 92 | int ptr_bits = (1 << lg_ptr_size) * 8; |
| 93 | int ngroup = (1 << lg_ngroup); |
| 94 | int ntiny = 0; |
| 95 | int nlbins = 0; |
| 96 | int lg_tiny_maxclass = (unsigned)-1; |
| 97 | int nbins = 0; |
| 98 | int npsizes = 0; |
| 99 | |
| 100 | int index = 0; |
| 101 | |
| 102 | int ndelta = 0; |
| 103 | int lg_base = lg_tiny_min; |
| 104 | int lg_delta = lg_base; |
| 105 | |
| 106 | /* Outputs that we update as we go. */ |
| 107 | size_t lookup_maxclass = 0; |
| 108 | size_t small_maxclass = 0; |
| 109 | int lg_large_minclass = 0; |
| 110 | size_t large_maxclass = 0; |
| 111 | |
| 112 | /* Tiny size classes. */ |
| 113 | while (lg_base < lg_quantum) { |
| 114 | sc_t *sc = &sc_data->sc[index]; |
| 115 | size_class(sc, lg_max_lookup, lg_page, lg_ngroup, index, |
| 116 | lg_base, lg_delta, ndelta); |
| 117 | if (sc->lg_delta_lookup != 0) { |
| 118 | nlbins = index + 1; |
| 119 | } |
| 120 | if (sc->psz) { |
| 121 | npsizes++; |
| 122 | } |
| 123 | if (sc->bin) { |
| 124 | nbins++; |
| 125 | } |
| 126 | ntiny++; |
| 127 | /* Final written value is correct. */ |
| 128 | lg_tiny_maxclass = lg_base; |
| 129 | index++; |
| 130 | lg_delta = lg_base; |
| 131 | lg_base++; |
| 132 | } |
| 133 | |
| 134 | /* First non-tiny (pseudo) group. */ |
| 135 | if (ntiny != 0) { |
| 136 | sc_t *sc = &sc_data->sc[index]; |
| 137 | /* |
| 138 | * See the note in sc.h; the first non-tiny size class has an |
| 139 | * unusual encoding. |
| 140 | */ |
| 141 | lg_base--; |
no test coverage detected