MCPcopy Create free account
hub / github.com/DFHack/dfhack / choosePivot

Function choosePivot

depends/lua/src/ltablib.c:346–351  ·  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

344** "randomized" by 'rnd'
345*/
346static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) {
347 IdxT r4 = (up - lo) / 4; /* range/4 */
348 IdxT p = rnd % (r4 * 2) + (lo + r4);
349 lua_assert(lo + r4 <= p && p <= up - r4);
350 return p;
351}
352
353
354/*

Callers 1

auxsortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected