third_party/inchi/INCHI_BASE/src/ichican2.c
void insertions_sort_NeighList_AT_NUMBERS2( NEIGH_LIST base,
                                            AT_RANK *nRank,
                                            AT_RANK max_rj )
{
    AT_NUMB *i, *j, *pk, tmp, rj;
    int k, num = (int) *base++;
    for (k = 1, pk = base; k < num; k++, pk++)
    {
        i = pk;
        j = i + 1;
        rj = ( rank_mask_bit & nRank[(int) *j] );
        if (rj < max_rj)
        {
            while (j > base && rj < ( rank_mask_bit & nRank[(int) *i] ))
            {
                tmp = *i;
                *i = *j;
                *j = tmp;
                j = i--;
            }
        }
    }

    INCHI_HEAPCHK
}
/****************************************************************************
 Sort neighbors according to ranks in ascending order
****************************************************************************/
Sort neighbors according to ranks in ascending order
Sort neighbors according to ranks in ascending order
void insertions_sort_NeighList_AT_NUMBERS2( NEIGH_LIST base,
                                            AT_RANK *nRank,
                                            AT_RANK max_rj )
{
    AT_NUMB *i, *j, *pk, tmp, rj;
    int k, num = (int) *base++;
    for (k = 1, pk = base; k < num; k++, pk++)
    {
        i = pk;
        j = i + 1;
        rj = ( rank_mask_bit & nRank[(int) *j] );
        if (rj < max_rj)
        {
            while (j > base && rj < ( rank_mask_bit & nRank[(int) *i] ))
            {
                tmp = *i;
                *i = *j;
                *j = tmp;
                j = i--;
            }
        }
    }
    INCHI_HEAPCHK
}
void insertions_sort_NeighList_AT_NUMBERS2 ( NEIGH_LIST base , AT_RANK * nRank , AT_RANK max_rj ) { AT_NUMB * i , * j , * pk , tmp , rj ; int k , num = ( int ) * base ++ ; for ( k = 1 , pk = base ; k < num ; k ++ , pk ++ ) { i = pk ; j = i + 1 ; rj = ( rank_mask_bit & nRank [ ( int ) * j ] ) ; if ( rj < max_rj ) { while ( j > base && rj < ( rank_mask_bit & nRank [ ( int ) * i ] ) ) { tmp = * i ; * i = * j ; * j = tmp ; j = i -- ; } } } INCHI_HEAPCHK }
Sort neighbors according to ranks in ascending order
Sort neighbors according to ranks in ascending order