MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / choosePivot

Function choosePivot

lib/lua/src/ltablib.c:334–339  ·  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

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

Callers 1

auxsortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected