Ignore:
Timestamp:
Aug 31, 2023, 11:31:15 PM (2 years ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
950c58e
Parents:
92355883 (diff), 686912c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Resolve conflict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/algorithm.hfa

    r92355883 r2a301ff  
    99// Author           : Thierry Delisle
    1010// Created On       : Mon Oct 30 13:37:34 2017
    11 // Last Modified By : --
    12 // Last Modified On : --
    13 // Update Count     : 0
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 08:25:29 2023
     13// Update Count     : 3
    1414//
    1515
     
    1717
    1818#ifdef SAFE_SORT
    19 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort2( T * arr );
    20 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort3( T * arr );
    21 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort4( T * arr );
    22 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort5( T * arr );
    23 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort6( T * arr );
    24 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sortN( T * arr, size_t dim );
     19forall( T | { int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort2( T * arr );
     20forall( T | { int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort3( T * arr );
     21forall( T | { int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort4( T * arr );
     22forall( T | { int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort5( T * arr );
     23forall( T | { int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sort6( T * arr );
     24forall( T | { int ?<?( T, T ); int ?>?( T, T ); } ) static inline void __libcfa_small_sortN( T * arr, size_t dim );
    2525
    26 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } )
     26forall( T | { int ?<?( T, T ); int ?>?( T, T ); } )
    2727static inline void __libcfa_small_sort( T * arr, size_t dim ) {
    2828        switch( dim ) {
     
    4141#define SWAP(x,y) { T a = min(arr[x], arr[y]); T b = max(arr[x], arr[y]); arr[x] = a; arr[y] = b;}
    4242
    43 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } )
     43forall( T | { int ?<?( T, T ); int ?>?( T, T ); } )
    4444static inline void __libcfa_small_sort2( T * arr ) {
    4545        SWAP(0, 1);
    4646}
    4747
    48 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } )
     48forall( T | { int ?<?( T, T ); int ?>?( T, T ); } )
    4949static inline void __libcfa_small_sort3( T * arr ) {
    5050        SWAP(1, 2);
     
    5353}
    5454
    55 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } )
     55forall( T | { int ?<?( T, T ); int ?>?( T, T ); } )
    5656static inline void __libcfa_small_sort4( T * arr ) {
    5757        SWAP(0, 1);
     
    6262}
    6363
    64 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } )
     64forall( T | { int ?<?( T, T ); int ?>?( T, T ); } )
    6565static inline void __libcfa_small_sort5( T * arr ) {
    6666        SWAP(0, 1);
     
    7575}
    7676
    77 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } )
     77forall( T | { int ?<?( T, T ); int ?>?( T, T ); } )
    7878static inline void __libcfa_small_sort6( T * arr ) {
    7979        SWAP(1, 2);
     
    9191}
    9292
    93 forall( T | {  int ?<?( T, T ); int ?>?( T, T ); } )
     93forall( T | { int ?<?( T, T ); int ?>?( T, T ); } )
    9494static inline void __libcfa_small_sortN( T * arr, size_t dim ) {
    95         int i, j;
    96         for (i = 1; i < dim; i++) {
     95        for ( i; 1 ~ dim ) {
    9796                T tmp = arr[i];
    98                 for (j = i; j >= 1 && tmp < arr[j-1]; j--) {
     97                int j;
     98                for ( j = i; j >= 1 && tmp < arr[j-1]; j--) {
    9999                        arr[j] = arr[j-1];
    100100                }
     
    175175
    176176static inline void __libcfa_small_sortN( void* * arr, size_t dim ) {
    177         int i, j;
    178         for (i = 1; i < dim; i++) {
    179                 void* tmp = arr[i];
     177        for ( i; 1 ~ dim ) {
     178                void * tmp = arr[i];
     179                int j;
    180180                for (j = i; j >= 1 && tmp < arr[j-1]; j--) {
    181181                        arr[j] = arr[j-1];
Note: See TracChangeset for help on using the changeset viewer.