software/c-firmware/selftest.c
/*
* Second check: Naive sorting algorithm
*/
Second check: Naive sorting algorithm
Second check : Naive sorting algorithm
void naiveSort(int* numbers, int n) {
    char finished = 1;
    int tmp = 0;
    do {
        finished = 1;
        for(int idx = 0; idx < (n-1); ++idx) {
            if(numbers[idx+1] < numbers[idx]) {
                finished = 0;
                tmp = numbers[idx];
                numbers[idx] = numbers[idx+1];
                numbers[idx+1] = tmp;
            }
        }
    } while(!finished);
}
void naiveSort ( int * numbers , int n ) { char finished = 1 ; int tmp = 0 ; do { finished = 1 ; for ( int idx = 0 ; idx < ( n - 1 ) ; ++ idx ) { if ( numbers [ idx + 1 ] < numbers [ idx ] ) { finished = 0 ; tmp = numbers [ idx ] ; numbers [ idx ] = numbers [ idx + 1 ] ; numbers [ idx + 1 ] = tmp ; } } } while ( ! finished ) ; }
Second check: Naive sorting algorithm
Second check : Naive sorting algorithm