Changeset 20936 for trunk/Ohana/src/opihi/cmd.data/select.c
- Timestamp:
- Dec 7, 2008, 3:31:01 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/select.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/select.c
r7917 r20936 27 27 /* check size of in1, in2, tvec: must match */ 28 28 29 REALLOCATE (ovec[0].elements, float, MAX (tvec[0].Nelements, 1)); 30 for (i = 0; i < tvec[0].Nelements; i++) { 31 ovec[0].elements[i] = tvec[0].elements[i] ? in1[0].elements[i] : in2[0].elements[i]; 29 if ((in1->type == OPIHI_INT) && (in2->type == OPIHI_INT)) { 30 ResetVector (ovec, OPIHI_INT, MAX (tvec[0].Nelements, 1)); 31 } else { 32 ResetVector (ovec, OPIHI_FLT, MAX (tvec[0].Nelements, 1)); 32 33 } 33 ovec[0].Nelements = tvec[0].Nelements; 34 REALLOCATE (ovec[0].elements, float, MAX (ovec[0].Nelements, 1)); 34 35 // (in1 and in2) == (flt or int) and tvec == (flt or int) 36 if ((in1->type == OPIHI_FLT) && (in2->type == OPIHI_FLT) && (tvec->type == OPIHI_FLT)) { 37 for (i = 0; i < tvec[0].Nelements; i++) { 38 ovec[0].elements.Flt[i] = tvec[0].elements.Flt[i] ? in1[0].elements.Flt[i] : in2[0].elements.Flt[i]; 39 } 40 } 41 if ((in1->type == OPIHI_FLT) && (in2->type == OPIHI_FLT) && (tvec->type == OPIHI_INT)) { 42 for (i = 0; i < tvec[0].Nelements; i++) { 43 ovec[0].elements.Flt[i] = tvec[0].elements.Int[i] ? in1[0].elements.Flt[i] : in2[0].elements.Flt[i]; 44 } 45 } 46 if ((in1->type == OPIHI_INT) && (in2->type == OPIHI_FLT) && (tvec->type == OPIHI_FLT)) { 47 for (i = 0; i < tvec[0].Nelements; i++) { 48 ovec[0].elements.Flt[i] = tvec[0].elements.Flt[i] ? in1[0].elements.Int[i] : in2[0].elements.Flt[i]; 49 } 50 } 51 if ((in1->type == OPIHI_INT) && (in2->type == OPIHI_FLT) && (tvec->type == OPIHI_INT)) { 52 for (i = 0; i < tvec[0].Nelements; i++) { 53 ovec[0].elements.Flt[i] = tvec[0].elements.Int[i] ? in1[0].elements.Int[i] : in2[0].elements.Flt[i]; 54 } 55 } 56 if ((in1->type == OPIHI_FLT) && (in2->type == OPIHI_INT) && (tvec->type == OPIHI_FLT)) { 57 for (i = 0; i < tvec[0].Nelements; i++) { 58 ovec[0].elements.Flt[i] = tvec[0].elements.Flt[i] ? in1[0].elements.Flt[i] : in2[0].elements.Int[i]; 59 } 60 } 61 if ((in1->type == OPIHI_FLT) && (in2->type == OPIHI_INT) && (tvec->type == OPIHI_INT)) { 62 for (i = 0; i < tvec[0].Nelements; i++) { 63 ovec[0].elements.Flt[i] = tvec[0].elements.Int[i] ? in1[0].elements.Flt[i] : in2[0].elements.Int[i]; 64 } 65 } 66 if ((in1->type == OPIHI_INT) && (in2->type == OPIHI_INT) && (tvec->type == OPIHI_FLT)) { 67 for (i = 0; i < tvec[0].Nelements; i++) { 68 ovec[0].elements.Int[i] = tvec[0].elements.Flt[i] ? in1[0].elements.Int[i] : in2[0].elements.Int[i]; 69 } 70 } 71 if ((in1->type == OPIHI_INT) && (in2->type == OPIHI_INT) && (tvec->type == OPIHI_INT)) { 72 for (i = 0; i < tvec[0].Nelements; i++) { 73 ovec[0].elements.Int[i] = tvec[0].elements.Int[i] ? in1[0].elements.Int[i] : in2[0].elements.Int[i]; 74 } 75 } 35 76 36 77 DeleteVector (tvec);
Note:
See TracChangeset
for help on using the changeset viewer.
