MCPcopy Create free account
hub / github.com/dengwirda/jigsaw / push_lower

Method push_lower

src/libcpp/containers/prioritymap.hpp:172–298  ·  view source on GitHub ↗

------------- helper - push "hole" into sorted position */

Source from the content-addressed store, hash-verified

170
171/*------------- helper - push "hole" into sorted position */
172 __normal_call _write_it push_lower (
173 _write_it _head,
174 _write_it _tail,
175 _write_it _ipos,
176 data_type const&_data
177 )
178 {
179 if (_head == _tail) return _ipos ;
180 /*-- find position of root of last partial sub - tree */
181 _write_it _cpos ;
182 _write_it _imin ;
183 _write_it _iend = _head;
184 if (_tail - _head > 0)
185 {
186 _iend =
187 _head + (_tail-_head-1) / _nfan ;
188 }
189 /*-- push "hole" into sorted position on lower levels */
190 for ( ; _ipos < _iend; )
191 {
192 /*---------------------------- pos of right child */
193 _cpos = _head +
194 _nfan * (_ipos - _head) + _nfan ;
195 /*---------------------------- find minimum child */
196 _imin = _cpos;
197 switch (_nfan)
198 {
199 case 8 :
200 if (this->_pred((--_cpos)->_data ,
201 _imin ->_data))
202 _imin=_cpos; // falls through
203 case 7 :
204 if (this->_pred((--_cpos)->_data ,
205 _imin ->_data))
206 _imin=_cpos; // falls through
207 case 6 :
208 if (this->_pred((--_cpos)->_data ,
209 _imin ->_data))
210 _imin=_cpos; // falls through
211 case 5 :
212 if (this->_pred((--_cpos)->_data ,
213 _imin ->_data))
214 _imin=_cpos; // falls through
215 case 4 :
216 if (this->_pred((--_cpos)->_data ,
217 _imin ->_data))
218 _imin=_cpos; // falls through
219 case 3 :
220 if (this->_pred((--_cpos)->_data ,
221 _imin ->_data))
222 _imin=_cpos; // falls through
223 case 2 :
224 if (this->_pred((--_cpos)->_data ,
225 _imin ->_data))
226 _imin=_cpos; // falls through
227 }
228 /*---------------------- update heap-keys mapping */
229 _ipos->_data =

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected