IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37955


Ignore:
Timestamp:
Mar 5, 2015, 2:04:08 PM (11 years ago)
Author:
eugene
Message:

allow trinary math to work between different types (int/flt)

Location:
branches/eam_branches/ipp-20150112/Ohana/src/opihi/lib.shell
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150112/Ohana/src/opihi/lib.shell/evaluate_stack.c

    r36375 r37955  
    121121      got_three_op:
    122122        if (!status) {
    123           snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s or %s\n", stack[i-1].name, stack[i-2].name, stack[i-3].name);
     123          snprintf (line, 512, "syntax error: invalid operand for trinary operation: %s or %s or %s\n", stack[i-1].name, stack[i-2].name, stack[i-3].name);
    124124          push_error (line);
    125125          clear_stack (&tmp_stack);
  • branches/eam_branches/ipp-20150112/Ohana/src/opihi/lib.shell/stack_math.c

    r37869 r37955  
    7373      opihi_flt *M1  =  V1[0].vector[0].elements.Flt;                   \
    7474      opihi_flt *M2  =  V2[0].vector[0].elements.Flt;                   \
     75      opihi_flt *M3  =  V3[0].vector[0].elements.Flt;                   \
     76      opihi_flt *out = OUT[0].vector[0].elements.Flt;                   \
     77      for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) {               \
     78        *out = OP;                                                      \
     79      }                                                                 \
     80      break;                                                            \
     81    }                                                                   \
     82    if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_INT)) { \
     83      CopyVector (OUT[0].vector, V1[0].vector);                         \
     84      opihi_flt *M1  =  V1[0].vector[0].elements.Flt;                   \
     85      opihi_flt *M2  =  V2[0].vector[0].elements.Flt;                   \
     86      opihi_int *M3  =  V3[0].vector[0].elements.Int;                   \
     87      opihi_flt *out = OUT[0].vector[0].elements.Flt;                   \
     88      for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) {               \
     89        *out = OP;                                                      \
     90      }                                                                 \
     91      break;                                                            \
     92    }                                                                   \
     93    if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_INT) && (V3->vector->type == OPIHI_FLT)) { \
     94      CopyVector (OUT[0].vector, V1[0].vector);                         \
     95      opihi_flt *M1  =  V1[0].vector[0].elements.Flt;                   \
     96      opihi_int *M2  =  V2[0].vector[0].elements.Int;                   \
     97      opihi_flt *M3  =  V3[0].vector[0].elements.Flt;                   \
     98      opihi_flt *out = OUT[0].vector[0].elements.Flt;                   \
     99      for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) {               \
     100        *out = OP;                                                      \
     101      }                                                                 \
     102      break;                                                            \
     103    }                                                                   \
     104    if ((V1->vector->type == OPIHI_FLT) && (V2->vector->type == OPIHI_INT) && (V3->vector->type == OPIHI_INT)) { \
     105      CopyVector (OUT[0].vector, V2[0].vector);                         \
     106      opihi_flt *M1  =  V1[0].vector[0].elements.Flt;                   \
     107      opihi_int *M2  =  V2[0].vector[0].elements.Int;                   \
     108      opihi_int *M3  =  V3[0].vector[0].elements.Int;                   \
     109      opihi_int *out = OUT[0].vector[0].elements.Int;                   \
     110      for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) {               \
     111        *out = OP;                                                      \
     112      }                                                                 \
     113      break;                                                            \
     114    }                                                                   \
     115    if ((V1->vector->type == OPIHI_INT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_FLT)) { \
     116      CopyVector (OUT[0].vector, V2[0].vector);                         \
     117      opihi_int *M1  =  V1[0].vector[0].elements.Int;                   \
     118      opihi_flt *M2  =  V2[0].vector[0].elements.Flt;                   \
     119      opihi_flt *M3  =  V3[0].vector[0].elements.Flt;                   \
     120      opihi_flt *out = OUT[0].vector[0].elements.Flt;                   \
     121      for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) {               \
     122        *out = OP;                                                      \
     123      }                                                                 \
     124      break;                                                            \
     125    }                                                                   \
     126    if ((V1->vector->type == OPIHI_INT) && (V2->vector->type == OPIHI_FLT) && (V3->vector->type == OPIHI_INT)) { \
     127      CopyVector (OUT[0].vector, V2[0].vector);                         \
     128      opihi_int *M1  =  V1[0].vector[0].elements.Int;                   \
     129      opihi_flt *M2  =  V2[0].vector[0].elements.Flt;                   \
     130      opihi_int *M3  =  V3[0].vector[0].elements.Int;                   \
     131      opihi_flt *out = OUT[0].vector[0].elements.Flt;                   \
     132      for (i = 0; i < Nx; i++, out++, M1++, M2++, M3++) {               \
     133        *out = OP;                                                      \
     134      }                                                                 \
     135      break;                                                            \
     136    }                                                                   \
     137    if ((V1->vector->type == OPIHI_INT) && (V2->vector->type == OPIHI_INT) && (V3->vector->type == OPIHI_FLT)) { \
     138      CopyVector (OUT[0].vector, V3[0].vector);                         \
     139      opihi_int *M1  =  V1[0].vector[0].elements.Int;                   \
     140      opihi_int *M2  =  V2[0].vector[0].elements.Int;                   \
    75141      opihi_flt *M3  =  V3[0].vector[0].elements.Flt;                   \
    76142      opihi_flt *out = OUT[0].vector[0].elements.Flt;                   \
Note: See TracChangeset for help on using the changeset viewer.