Last change
on this file since 679 was
134,
checked in by kane, 14 years ago
|
add multi write buffer in cc_xcache_v4
|
File size:
723 bytes
|
Line | |
---|
1 | #include "sort.h" |
---|
2 | #include "system.h" |
---|
3 | #include "stdio.h" |
---|
4 | |
---|
5 | //------ simple_sort ------------------------------- |
---|
6 | void sort_selection(unsigned int *base, unsigned int n) |
---|
7 | { |
---|
8 | int i, min, j , x; |
---|
9 | |
---|
10 | for(i = 0 ; i < n - 1 ; i++) |
---|
11 | { |
---|
12 | |
---|
13 | #if VERBOSE_SORT |
---|
14 | printf("-"); // added for debug |
---|
15 | #endif |
---|
16 | |
---|
17 | min = i; |
---|
18 | |
---|
19 | for(j = i+1 ; j < n ; j++) |
---|
20 | { |
---|
21 | |
---|
22 | if(base[j] < base[min]) |
---|
23 | min = j; |
---|
24 | |
---|
25 | } |
---|
26 | |
---|
27 | if(min != i) |
---|
28 | { |
---|
29 | x = base[i]; |
---|
30 | base[i] = base[min]; |
---|
31 | base[min] = x; |
---|
32 | } |
---|
33 | |
---|
34 | #if VERBOSE_SORT |
---|
35 | printf("+"); // added for debug |
---|
36 | #endif |
---|
37 | } |
---|
38 | #if VERBOSE_SORT |
---|
39 | printf("\n"); |
---|
40 | #endif |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.