MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / choosePivot

Function choosePivot

third-party/lua-5.5.0/src/ltablib.c:330–335  ·  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

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

Callers 1

auxsortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected