IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7042


Ignore:
Timestamp:
May 2, 2006, 11:48:55 AM (20 years ago)
Author:
Paul Price
Message:

Fixing bug in psVectorSortIndex --- the switch was on the output type instead of the input type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psVector.c

    r6977 r7042  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2006-04-25 03:30:29 $
     11*  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2006-05-02 21:48:55 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    403403#define PSVECTOR_SORT_INDEX_CASE(NAME) \
    404404case PS_TYPE_##NAME: { \
    405     psU32 temp; \
    406     psU32 *index = out->data.U32; \
     405    psS32 temp; \
     406    psS32 *index = out->data.S32; \
    407407    ps##NAME *value = inVector->data.NAME; \
    408408    for (;;) { \
     
    417417            } \
    418418        } \
    419         int i = l; \
    420         int j = (l << 1) + 1; \
     419        long i = l; \
     420        long j = (l << 1) + 1; \
    421421        while (j <= ir) { \
    422422            if (j < ir && value[index[j]] < value[index[j+1]]) \
    423423                ++j; \
    424             if (value[temp] < value[index[j]]) { \
     424            if (value[temp ] < value[index[j]]) { \
    425425                index[i]=index[j]; \
    426426                j += (i=j) + 1; \
     
    444444    }
    445445
    446     psVector *out = psVectorRecycle(outVector, inVector->n, PS_TYPE_U32); // Vector for output
    447     out = psVectorCreate(out, 0, inVector->n, 1, PS_TYPE_U32);
     446    psVector *out = psVectorRecycle(outVector, inVector->n, PS_TYPE_S32); // Vector for output
     447    out = psVectorCreate(out, 0, inVector->n, 1, PS_TYPE_S32);
    448448    long N = out->n;                    // Number of elements
    449449    if (N < 2) {
     
    452452    long l = N >> 1;
    453453    long ir = N - 1;
    454     switch (out->type.type) {
     454    switch (inVector->type.type) {
    455455        PSVECTOR_SORT_INDEX_CASE(U8);
    456456        PSVECTOR_SORT_INDEX_CASE(U16);
Note: See TracChangeset for help on using the changeset viewer.