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