MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / choosePivot

Function choosePivot

libraries/AP_Scripting/lua/src/ltablib.c:350–355  ·  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

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

Callers 1

auxsortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected