#include <stdio.h>
#include "host.h"
#include "scrollview.h"
Go to the source code of this file.
|
| inT32 | choose_nth_item (inT32 index, float *array, inT32 count) |
| |
| inT32 | choose_nth_item (inT32 index, void *array, inT32 count, size_t size, int(*compar)(const void *, const void *)) |
| |
| void | swap_entries (void *array, size_t size, inT32 index1, inT32 index2) |
| |
Definition at line 550 of file statistc.cpp.
561 if (array[0] < array[1]) {
562 return index >= 1 ? 1 : 0;
565 return index >= 1 ? 0 : 1;
571 else if (index >=
count)
574 pivot = array[equal_count];
576 array[equal_count] = array[0];
578 prev_greater =
count;
580 for (next_sample = 1; next_sample < prev_greater;) {
581 sample = array[next_sample];
582 if (sample < pivot) {
584 array[next_lesser++] = sample;
587 else if (sample > pivot) {
590 array[next_sample] = array[prev_greater];
591 array[prev_greater] = sample;
598 for (next_sample = next_lesser; next_sample < prev_greater;)
599 array[next_sample++] = pivot;
600 if (index < next_lesser)
602 else if (index < prev_greater)
606 array + prev_greater,
607 count - prev_greater) + prev_greater;
inT32 choose_nth_item(inT32 index, float *array, inT32 count)
| inT32 choose_nth_item |
( |
inT32 |
index, |
|
|
void * |
array, |
|
|
inT32 |
count, |
|
|
size_t |
size, |
|
|
int(*)(const void *, const void *) |
compar |
|
) |
| |
Definition at line 617 of file statistc.cpp.
629 if (compar (array, (
char *) array + size) < 0) {
630 return index >= 1 ? 1 : 0;
633 return index >= 1 ? 0 : 1;
638 else if (index >=
count)
643 prev_greater =
count;
645 for (next_sample = 1; next_sample < prev_greater;) {
647 compar ((
char *) array + size * next_sample,
648 (
char *) array + size * next_lesser);
650 swap_entries (array, size, next_lesser++, next_sample++);
653 else if (result > 0) {
662 if (index < next_lesser)
664 else if (index < prev_greater)
668 (
char *) array + size * prev_greater,
669 count - prev_greater, size,
670 compar) + prev_greater;
void swap_entries(void *array, size_t size, inT32 index1, inT32 index2)
inT32 choose_nth_item(inT32 index, float *array, inT32 count)
| void swap_entries |
( |
void * |
array, |
|
|
size_t |
size, |
|
|
inT32 |
index1, |
|
|
inT32 |
index2 |
|
) |
| |
Definition at line 678 of file statistc.cpp.
687 ptr1 =
reinterpret_cast<char*
>(array) + index1 * size;
688 ptr2 =
reinterpret_cast<char*
>(array) + index2 * size;
689 for (count = 0; count < size; count++) {