void find_largest ( uint * a, uint32 b)

/* This is the worlds least efficient array search 
 * intended to be order n^2 - changes the input array as a side effect, and 
 * besides that violates a few other coding best practices
 */
void find_largest ( uint * a, uint32 b)
{
    uint array[b], i, ii, *j= a, *k = a, max;

    for ( i=0, k=a; i < b; i++,j++)
    {
         array[i] = *j;
         for (ii=0; ii < b; ii++)
         {
             if (array[ii] > max) max = array[ii];
             if (max > k[ii]) k[ii] = max;
         }
    }
    return k[ii-1];
}

 

Time for an Open Source Rant

<rant>

As I have previously stated, parts of Linux and parts of the open source world are ok, they provide some utility.

But I have problems with the gospel that drivels from these paragons of design, telling us it’s the future and the way forward, and they’ve brainwashed too many in the positions of influence so we’re stuck trying to make stuff work with things programmed by someone as their HOBBY.

I work – to deliver on time – to sell product – to make money.  It’s capitalism.  It’s business.
Open source – is at it’s root socialist and maybe even communist.

</rant>