MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / choosePivot

Function choosePivot

extlibs/lua/src/ltablib.c:332–337  ·  view source on GitHub ↗

** Choose an element in the middle (2nd-3th quarters) of [lo,up] ** "randomized" by 'rnd' */

Source from the content-addressed store, hash-verified

330** "randomized" by 'rnd'
331*/
332static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) {
333 IdxT r4 = (up - lo) / 4; /* range/4 */
334 IdxT p = rnd % (r4 * 2) + (lo + r4);
335 lua_assert(lo + r4 <= p && p <= up - r4);
336 return p;
337}
338
339
340/*

Callers 1

auxsortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected