Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:05:32

0001 /*
0002  *  qp_exev_op_cmp.h  --
0003  *
0004  *  Original: 23-Jan-1995 17:17
0005  *
0006  *  Author:   Maarten Ballintijn <Maarten.Ballintijn@cern.ch>
0007  *
0008  *  $Id$
0009  *
0010  *  $Log$
0011  *  Revision 1.5  1996/04/23 18:38:39  maartenb
0012  *  - Add RCS keywords
0013  *
0014  *
0015  */
0016 
0017 case FC_LT + (OP_BASE):
0018 {
0019     OP_TYPE     tmp1, tmp2;
0020     int     i, n = 1;
0021 
0022     if ( frame_size[framep] != 1 ) {
0023         o1 = &stack[frame[framep]];
0024         inc_o1 = datatype_size[OP_DTYPE];
0025         qp_assert( n==1 || n==frame_size[framep-1] );
0026         n = frame_size[framep];
0027     } else {
0028         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0029         o1 = (Int32 *) &tmp1;
0030         inc_o1 = 0;
0031     }
0032     if ( frame_size[framep-1] != 1 ) {
0033         o2 = &stack[frame[framep-1]];
0034         inc_o2 = datatype_size[OP_DTYPE];
0035         qp_assert( n==1 || n==frame_size[framep-1] );
0036         n = frame_size[framep-1];
0037     } else {
0038         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0039         o2 = (Int32 *) &tmp2;
0040         inc_o2 = 0;
0041     }
0042     POP_FRAME(2);
0043 
0044     NEW_FRAME(D_BOOL,n,r);
0045     inc_r = datatype_size[D_BOOL];
0046 
0047     o1 += inc_o1 * (n-1);
0048     o2 += inc_o2 * (n-1);
0049     r += inc_r * (n-1);
0050     for ( i=0 ; i < n ; i++ ) {
0051         if ( (*((OP_TYPE *) o1)) < (*((OP_TYPE *) o2)) ) {
0052             *((bool *) r) = TRUE;
0053         } else {
0054             *((bool *) r) = FALSE;
0055         }
0056         o1 -= inc_o1;
0057         o2 -= inc_o2;
0058         r -= inc_r;
0059     }
0060     break;
0061 }
0062 
0063 case FC_LE + (OP_BASE):
0064 {
0065     OP_TYPE     tmp1, tmp2;
0066     int     i, n = 1;
0067 
0068     if ( frame_size[framep] != 1 ) {
0069         o1 = &stack[frame[framep]];
0070         inc_o1 = datatype_size[OP_DTYPE];
0071         qp_assert( n==1 || n==frame_size[framep-1] );
0072         n = frame_size[framep];
0073     } else {
0074         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0075         o1 = (Int32 *) &tmp1;
0076         inc_o1 = 0;
0077     }
0078     if ( frame_size[framep-1] != 1 ) {
0079         o2 = &stack[frame[framep-1]];
0080         inc_o2 = datatype_size[OP_DTYPE];
0081         qp_assert( n==1 || n==frame_size[framep-1] );
0082         n = frame_size[framep-1];
0083     } else {
0084         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0085         o2 = (Int32 *) &tmp2;
0086         inc_o2 = 0;
0087     }
0088     POP_FRAME(2);
0089 
0090     NEW_FRAME(D_BOOL,n,r);
0091     inc_r = datatype_size[D_BOOL];
0092 
0093     o1 += inc_o1 * (n-1);
0094     o2 += inc_o2 * (n-1);
0095     r += inc_r * (n-1);
0096     for ( i=0 ; i < n ; i++ ) {
0097         if ( *((OP_TYPE *) o1) <= *((OP_TYPE *) o2) ) {
0098             *((bool *) r) = TRUE;
0099         } else {
0100             *((bool *) r) = FALSE;
0101         }
0102         o1 -= inc_o1;
0103         o2 -= inc_o2;
0104         r -= inc_r;
0105     }
0106     break;
0107 }
0108 
0109 
0110 /*
0111  *  Combine these entries to shrink the case statement, to avoid 
0112  *  HP-C case statement bug :-(
0113  */
0114 case FC_LTLT + (OP_BASE):
0115 case FC_LTLE + (OP_BASE):
0116 case FC_LELT + (OP_BASE):
0117 case FC_LELE + (OP_BASE):
0118 case FC_GTGT + (OP_BASE):
0119 case FC_GTGE + (OP_BASE):
0120 case FC_GEGT + (OP_BASE):
0121 case FC_GEGE + (OP_BASE):
0122 {
0123     OP_TYPE     tmp1, tmp2, tmp3;
0124     int     i, n = 1;
0125 
0126     if ( frame_size[framep] != 1 ) {
0127         o1 = &stack[frame[framep]];
0128         inc_o1 = datatype_size[OP_DTYPE];
0129         qp_assert( n==1 || n==frame_size[framep-1] );
0130         n = frame_size[framep];
0131     } else {
0132         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0133         o1 = (Int32 *) &tmp1;
0134         inc_o1 = 0;
0135     }
0136     if ( frame_size[framep-1] != 1 ) {
0137         o2 = &stack[frame[framep-1]];
0138         inc_o2 = datatype_size[OP_DTYPE];
0139         qp_assert( n==1 || n==frame_size[framep-1] );
0140         n = frame_size[framep-1];
0141     } else {
0142         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0143         o2 = (Int32 *) &tmp2;
0144         inc_o2 = 0;
0145     }
0146     if ( frame_size[framep-2] != 1 ) {
0147         o3 = &stack[frame[framep-2]];
0148         inc_o3 = datatype_size[OP_DTYPE];
0149         qp_assert( n==1 || n==frame_size[framep-2] );
0150         n = frame_size[framep-2];
0151     } else {
0152         tmp3 = *((OP_TYPE *) &stack[frame[framep-2]]);
0153         o3 = (Int32 *) &tmp3;
0154         inc_o3 = 0;
0155     }
0156     POP_FRAME(3);
0157 
0158     NEW_FRAME(D_BOOL,n,r);
0159     inc_r = datatype_size[D_BOOL];
0160 
0161     o1 += inc_o1 * (n-1);
0162     o2 += inc_o2 * (n-1);
0163     o3 += inc_o3 * (n-1);
0164     r += inc_r * (n-1);
0165 
0166     switch ( fc ) {
0167     case FC_LTLT + (OP_BASE):
0168         for ( i=0 ; i < n ; i++ ) {
0169             if ( (*((OP_TYPE *) o1) < *((OP_TYPE *) o2)) &&
0170                 (*((OP_TYPE *) o2) < *((OP_TYPE *) o3))
0171             ) {
0172                 *((bool *) r) = TRUE;
0173             } else {
0174                 *((bool *) r) = FALSE;
0175             }
0176             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0177         }
0178         break;
0179     case FC_LTLE + (OP_BASE):
0180         for ( i=0 ; i < n ; i++ ) {
0181             if ( (*((OP_TYPE *) o1) < *((OP_TYPE *) o2)) &&
0182                 (*((OP_TYPE *) o2) <= *((OP_TYPE *) o3))
0183             ) {
0184                 *((bool *) r) = TRUE;
0185             } else {
0186                 *((bool *) r) = FALSE;
0187             }
0188             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0189         }
0190         break;
0191     case FC_LELT + (OP_BASE):
0192         for ( i=0 ; i < n ; i++ ) {
0193             if ( (*((OP_TYPE *) o1) <= *((OP_TYPE *) o2)) &&
0194                 (*((OP_TYPE *) o2) < *((OP_TYPE *) o3))
0195             ) {
0196                 *((bool *) r) = TRUE;
0197             } else {
0198                 *((bool *) r) = FALSE;
0199             }
0200             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0201         }
0202         break;
0203     case FC_LELE + (OP_BASE):
0204         for ( i=0 ; i < n ; i++ ) {
0205             if ( (*((OP_TYPE *) o1) <= *((OP_TYPE *) o2)) &&
0206                 (*((OP_TYPE *) o2) <= *((OP_TYPE *) o3))
0207             ) {
0208                 *((bool *) r) = TRUE;
0209             } else {
0210                 *((bool *) r) = FALSE;
0211             }
0212             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0213         }
0214         break;
0215     case FC_GTGT + (OP_BASE):
0216         for ( i=0 ; i < n ; i++ ) {
0217             if ( (*((OP_TYPE *) o1) > *((OP_TYPE *) o2)) &&
0218                 (*((OP_TYPE *) o2) > *((OP_TYPE *) o3))
0219             ) {
0220                 *((bool *) r) = TRUE;
0221             } else {
0222                 *((bool *) r) = FALSE;
0223             }
0224             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0225         }
0226         break;
0227     case FC_GTGE + (OP_BASE):
0228         for ( i=0 ; i < n ; i++ ) {
0229             if ( (*((OP_TYPE *) o1) > *((OP_TYPE *) o2)) &&
0230                 (*((OP_TYPE *) o2) >= *((OP_TYPE *) o3))
0231             ) {
0232                 *((bool *) r) = TRUE;
0233             } else {
0234                 *((bool *) r) = FALSE;
0235             }
0236             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0237         }
0238         break;
0239     case FC_GEGT + (OP_BASE):
0240         for ( i=0 ; i < n ; i++ ) {
0241             if ( (*((OP_TYPE *) o1) >= *((OP_TYPE *) o2)) &&
0242                 (*((OP_TYPE *) o2) > *((OP_TYPE *) o3))
0243             ) {
0244                 *((bool *) r) = TRUE;
0245             } else {
0246                 *((bool *) r) = FALSE;
0247             }
0248             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0249         }
0250         break;
0251     case FC_GEGE + (OP_BASE):
0252         for ( i=0 ; i < n ; i++ ) {
0253             if ( (*((OP_TYPE *) o1) >= *((OP_TYPE *) o2)) &&
0254                 (*((OP_TYPE *) o2) >= *((OP_TYPE *) o3))
0255             ) {
0256                 *((bool *) r) = TRUE;
0257             } else {
0258                 *((bool *) r) = FALSE;
0259             }
0260             o1 -= inc_o1; o2 -= inc_o2; o3 -= inc_o3; r -= inc_r;
0261         }
0262         break;
0263     default:
0264         qp_assert(0);
0265         break;
0266     }
0267     break;
0268 }
0269 
0270 
0271 case FC_GT + (OP_BASE):
0272 {
0273     OP_TYPE     tmp1, tmp2;
0274     int     i, n = 1;
0275 
0276     if ( frame_size[framep] != 1 ) {
0277         o1 = &stack[frame[framep]];
0278         inc_o1 = datatype_size[OP_DTYPE];
0279         qp_assert( n==1 || n==frame_size[framep-1] );
0280         n = frame_size[framep];
0281     } else {
0282         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0283         o1 = (Int32 *) &tmp1;
0284         inc_o1 = 0;
0285     }
0286     if ( frame_size[framep-1] != 1 ) {
0287         o2 = &stack[frame[framep-1]];
0288         inc_o2 = datatype_size[OP_DTYPE];
0289         qp_assert( n==1 || n==frame_size[framep-1] );
0290         n = frame_size[framep-1];
0291     } else {
0292         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0293         o2 = (Int32 *) &tmp2;
0294         inc_o2 = 0;
0295     }
0296     POP_FRAME(2);
0297 
0298     NEW_FRAME(D_BOOL,n,r);
0299     inc_r = datatype_size[D_BOOL];
0300 
0301     o1 += inc_o1 * (n-1);
0302     o2 += inc_o2 * (n-1);
0303     r += inc_r * (n-1);
0304     for ( i=0 ; i < n ; i++ ) {
0305         if ( *((OP_TYPE *) o1) > *((OP_TYPE *) o2) ) {
0306             *((bool *) r) = TRUE;
0307         } else {
0308             *((bool *) r) = FALSE;
0309         }
0310         o1 -= inc_o1;
0311         o2 -= inc_o2;
0312         r -= inc_r;
0313     }
0314     break;
0315 }
0316 
0317 case FC_GE + (OP_BASE):
0318 {
0319     OP_TYPE     tmp1, tmp2;
0320     int     i, n = 1;
0321 
0322     if ( frame_size[framep] != 1 ) {
0323         o1 = &stack[frame[framep]];
0324         inc_o1 = datatype_size[OP_DTYPE];
0325         qp_assert( n==1 || n==frame_size[framep-1] );
0326         n = frame_size[framep];
0327     } else {
0328         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0329         o1 = (Int32 *) &tmp1;
0330         inc_o1 = 0;
0331     }
0332     if ( frame_size[framep-1] != 1 ) {
0333         o2 = &stack[frame[framep-1]];
0334         inc_o2 = datatype_size[OP_DTYPE];
0335         qp_assert( n==1 || n==frame_size[framep-1] );
0336         n = frame_size[framep-1];
0337     } else {
0338         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0339         o2 = (Int32 *) &tmp2;
0340         inc_o2 = 0;
0341     }
0342     POP_FRAME(2);
0343 
0344     NEW_FRAME(D_BOOL,n,r);
0345     inc_r = datatype_size[D_BOOL];
0346 
0347     o1 += inc_o1 * (n-1);
0348     o2 += inc_o2 * (n-1);
0349     r += inc_r * (n-1);
0350     for ( i=0 ; i < n ; i++ ) {
0351         if ( *((OP_TYPE *) o1) >= *((OP_TYPE *) o2) ) {
0352             *((bool *) r) = TRUE;
0353         } else {
0354             *((bool *) r) = FALSE;
0355         }
0356         o1 -= inc_o1;
0357         o2 -= inc_o2;
0358         r -= inc_r;
0359     }
0360     break;
0361 }
0362 
0363 
0364 case FC_EQ + (OP_BASE):
0365 {
0366     OP_TYPE     tmp1, tmp2;
0367     int     i, n = 1;
0368 
0369     if ( frame_size[framep] != 1 ) {
0370         o1 = &stack[frame[framep]];
0371         inc_o1 = datatype_size[OP_DTYPE];
0372         qp_assert( n==1 || n==frame_size[framep-1] );
0373         n = frame_size[framep];
0374     } else {
0375         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0376         o1 = (Int32 *) &tmp1;
0377         inc_o1 = 0;
0378     }
0379     if ( frame_size[framep-1] != 1 ) {
0380         o2 = &stack[frame[framep-1]];
0381         inc_o2 = datatype_size[OP_DTYPE];
0382         qp_assert( n==1 || n==frame_size[framep-1] );
0383         n = frame_size[framep-1];
0384     } else {
0385         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0386         o2 = (Int32 *) &tmp2;
0387         inc_o2 = 0;
0388     }
0389     POP_FRAME(2);
0390 
0391     NEW_FRAME(D_BOOL,n,r);
0392     inc_r = datatype_size[D_BOOL];
0393 
0394     o1 += inc_o1 * (n-1);
0395     o2 += inc_o2 * (n-1);
0396     r += inc_r * (n-1);
0397     for ( i=0 ; i < n ; i++ ) {
0398         if ( *((OP_TYPE *) o1) == *((OP_TYPE *) o2) ) {
0399             *((bool *) r) = TRUE;
0400         } else {
0401             *((bool *) r) = FALSE;
0402         }
0403         o1 -= inc_o1;
0404         o2 -= inc_o2;
0405         r -= inc_r;
0406     }
0407     break;
0408 }
0409 
0410 case FC_NE + (OP_BASE):
0411 {
0412     OP_TYPE     tmp1, tmp2;
0413     int     i, n = 1;
0414 
0415     if ( frame_size[framep] != 1 ) {
0416         o1 = &stack[frame[framep]];
0417         inc_o1 = datatype_size[OP_DTYPE];
0418         qp_assert( n==1 || n==frame_size[framep-1] );
0419         n = frame_size[framep];
0420     } else {
0421         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0422         o1 = (Int32 *) &tmp1;
0423         inc_o1 = 0;
0424     }
0425     if ( frame_size[framep-1] != 1 ) {
0426         o2 = &stack[frame[framep-1]];
0427         inc_o2 = datatype_size[OP_DTYPE];
0428         qp_assert( n==1 || n==frame_size[framep-1] );
0429         n = frame_size[framep-1];
0430     } else {
0431         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0432         o2 = (Int32 *) &tmp2;
0433         inc_o2 = 0;
0434     }
0435     POP_FRAME(2);
0436 
0437     NEW_FRAME(D_BOOL,n,r);
0438     inc_r = datatype_size[D_BOOL];
0439 
0440     o1 += inc_o1 * (n-1);
0441     o2 += inc_o2 * (n-1);
0442     r += inc_r * (n-1);
0443     for ( i=0 ; i < n ; i++ ) {
0444         if ( *((OP_TYPE *) o1) != *((OP_TYPE *) o2) ) {
0445             *((bool *) r) = TRUE;
0446         } else {
0447             *((bool *) r) = FALSE;
0448         }
0449         o1 -= inc_o1;
0450         o2 -= inc_o2;
0451         r -= inc_r;
0452     }
0453     break;
0454 }
0455 
0456 /* this needs a specific implementation, probably ... :-( */
0457 case FC_CT + (OP_BASE):
0458 {
0459     OP_TYPE     tmp1, tmp2;
0460     int     i, n = 1;
0461 
0462     sf_report( "Warning: FC_CT not implemented properly\n" );
0463 
0464     if ( frame_size[framep] != 1 ) {
0465         o1 = &stack[frame[framep]];
0466         inc_o1 = datatype_size[OP_DTYPE];
0467         qp_assert( n==1 || n==frame_size[framep-1] );
0468         n = frame_size[framep];
0469     } else {
0470         tmp1 = *((OP_TYPE *) &stack[frame[framep]]);
0471         o1 = (Int32 *) &tmp1;
0472         inc_o1 = 0;
0473     }
0474     if ( frame_size[framep-1] != 1 ) {
0475         o2 = &stack[frame[framep-1]];
0476         inc_o2 = datatype_size[OP_DTYPE];
0477         qp_assert( n==1 || n==frame_size[framep-1] );
0478         n = frame_size[framep-1];
0479     } else {
0480         tmp2 = *((OP_TYPE *) &stack[frame[framep-1]]);
0481         o2 = (Int32 *) &tmp2;
0482         inc_o2 = 0;
0483     }
0484     POP_FRAME(2);
0485 
0486     NEW_FRAME(D_BOOL,n,r);
0487     inc_r = datatype_size[D_BOOL];
0488 
0489     o1 += inc_o1 * (n-1);
0490     o2 += inc_o2 * (n-1);
0491     r += inc_r * (n-1);
0492     for ( i=0 ; i < n ; i++ ) {
0493         if ( *((OP_TYPE *) o1) == *((OP_TYPE *) o2) ) {
0494             *((bool *) r) = TRUE;
0495         } else {
0496             *((bool *) r) = FALSE;
0497         }
0498         o1 -= inc_o1;
0499         o2 -= inc_o2;
0500         r -= inc_r;
0501     }
0502     break;
0503 }