Skip to content

Commit 252076d

Browse files
committed
oracle: add comment to sort explaining network principle
1 parent 98bf64d commit 252076d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

program/src/oracle/sort/sort_stable_base_gen.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ sort_gen( int n ) {
5656
//printf( " ulong n ) { /* assumes n in [0,%i) */\n", n );
5757

5858
printf( " do { /* BEGIN AUTOGENERATED CODE (n=%2i) *****************************/\n", n );
59+
printf( " /* This network of comparators and fallthroughs implement a sorting network representation\n" );
60+
printf( " of an insertion sort. Each case acts as a sort pass with the fallthrough falling through\n" );
61+
printf( " to smaller ranges of the input. */\n");
5962
printf( "# define SORT_STABLE_CE(i,j) u = x[(SORT_IDX_T)i]; v = x[(SORT_IDX_T)j]; c = SORT_BEFORE( v, u ); x[(SORT_IDX_T)i] = c ? v : u; x[(SORT_IDX_T)j] = c ? u : v\n" );
6063
printf( " int c;\n" );
6164
printf( " SORT_KEY_T u;\n" );

program/src/oracle/sort/tmpl/sort_stable_base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
do { /* BEGIN AUTOGENERATED CODE (n= 7) *****************************/
2+
/* This network of comparators and fallthroughs implement a sorting network representation
3+
of an insertion sort. Each case acts as a sort pass with the fallthrough falling through
4+
to smaller ranges of the input. */
25
# define SORT_STABLE_CE(i,j) u = x[(SORT_IDX_T)i]; v = x[(SORT_IDX_T)j]; c = SORT_BEFORE( v, u ); x[(SORT_IDX_T)i] = c ? v : u; x[(SORT_IDX_T)j] = c ? u : v
36
int c;
47
SORT_KEY_T u;

0 commit comments

Comments
 (0)