| 138 | */ |
| 139 | |
| 140 | __normal_call _write_it push_lower ( |
| 141 | _write_it _head, |
| 142 | _write_it _tail, |
| 143 | _write_it _ipos, |
| 144 | data_type const&_data |
| 145 | ) |
| 146 | { |
| 147 | if (_head == _tail) return _ipos ; |
| 148 | /*-- find position of "root" within trailing sub-tree */ |
| 149 | _write_it _cpos ; |
| 150 | _write_it _imin ; |
| 151 | _write_it _iend = _head; |
| 152 | if (_tail - _head > 0) |
| 153 | { |
| 154 | _iend = |
| 155 | _head + (_tail-_head-1) / _nfan ; |
| 156 | } |
| 157 | /*-- push "hole" into sorted position on lower levels */ |
| 158 | for ( ; _ipos < _iend; ) |
| 159 | { |
| 160 | /*---------------------------- pos of right child */ |
| 161 | _cpos = _head + |
| 162 | _nfan * (_ipos - _head) + _nfan ; |
| 163 | /*---------------------------- find minimum child */ |
| 164 | _imin = _cpos; |
| 165 | switch (_nfan) |
| 166 | { |
| 167 | case 8 : |
| 168 | if (this->_pred(*--_cpos,*_imin)) |
| 169 | _imin=_cpos; // falls through |
| 170 | case 7 : |
| 171 | if (this->_pred(*--_cpos,*_imin)) |
| 172 | _imin=_cpos; // falls through |
| 173 | case 6 : |
| 174 | if (this->_pred(*--_cpos,*_imin)) |
| 175 | _imin=_cpos; // falls through |
| 176 | case 5 : |
| 177 | if (this->_pred(*--_cpos,*_imin)) |
| 178 | _imin=_cpos; // falls through |
| 179 | case 4 : |
| 180 | if (this->_pred(*--_cpos,*_imin)) |
| 181 | _imin=_cpos; // falls through |
| 182 | case 3 : |
| 183 | if (this->_pred(*--_cpos,*_imin)) |
| 184 | _imin=_cpos; // falls through |
| 185 | case 2 : |
| 186 | if (this->_pred(*--_cpos,*_imin)) |
| 187 | _imin=_cpos; // falls through |
| 188 | } |
| 189 | /*------------------------------ swap with "hole" */ |
| 190 | *_ipos = std::move(*_imin) ; |
| 191 | _ipos = _imin ; |
| 192 | } |
| 193 | /*-- deal with special cases - sort trailing sub-tree */ |
| 194 | if (_ipos == _iend) |
| 195 | { |
| 196 | size_type _inum = |
| 197 | _tail-_head-_nfan*(_ipos-_head); |
nothing calls this directly
no outgoing calls
no test coverage detected