Changeset 7189
- Timestamp:
- May 23, 2006, 1:43:18 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/math/psBinaryOp.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/math/psBinaryOp.c
r6885 r7189 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $33 * @date $Date: 2006-0 4-18 22:04:28 $32 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2006-05-23 23:43:18 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 325 325 } 326 326 327 328 // Preprocessor macro function to create arithmetic function based on input type for integers only 329 #define BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,OP,IN2) \ 330 switch (IN1->type) { \ 331 case PS_TYPE_U8: \ 332 DIM1##_##DIM2(OUT,IN1,OP,IN2,U8); \ 333 break; \ 334 case PS_TYPE_U16: \ 335 DIM1##_##DIM2(OUT,IN1,OP,IN2,U16); \ 336 break; \ 337 case PS_TYPE_U32: \ 338 DIM1##_##DIM2(OUT,IN1,OP,IN2,U32); \ 339 break; \ 340 case PS_TYPE_U64: \ 341 DIM1##_##DIM2(OUT,IN1,OP,IN2,U64); \ 342 break; \ 343 case PS_TYPE_S8: \ 344 DIM1##_##DIM2(OUT,IN1,OP,IN2,S8); \ 345 break; \ 346 case PS_TYPE_S16: \ 347 DIM1##_##DIM2(OUT,IN1,OP,IN2,S16); \ 348 break; \ 349 case PS_TYPE_S32: \ 350 DIM1##_##DIM2(OUT,IN1,OP,IN2,S32); \ 351 break; \ 352 case PS_TYPE_S64: \ 353 DIM1##_##DIM2(OUT,IN1,OP,IN2,S64); \ 354 break; \ 355 default: \ 356 /* char* strType; \ 357 PS_TYPE_NAME(strType,IN1->type); \ 358 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 359 PS_ERRORTEXT_psMatrix_TYPE_MISMATCH, \ 360 strType); */ \ 361 if (OUT != IN1 && OUT != IN2) { \ 362 psFree(OUT); \ 363 } \ 364 return NULL; \ 365 } 366 327 367 // Preprocessor macro function to create arithmetic function based on input type 328 368 #define BINARY_TYPE(DIM1,DIM2,OUT,IN1,OP,IN2) \ … … 365 405 break; \ 366 406 default: \ 367 /* char* strType; \407 /* char* strType; \ 368 408 PS_TYPE_NAME(strType,IN1->type); \ 369 409 psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ 370 410 PS_ERRORTEXT_psMatrix_TYPE_MISMATCH, \ 371 strType); */ \411 strType); */ \ 372 412 if (OUT != IN1 && OUT != IN2) { \ 373 413 psFree(OUT); \ … … 388 428 } else if(!strncmp(OP, "/", 1)) { \ 389 429 BINARY_TYPE(DIM1,DIM2,OUT,IN1,*i1 / *i2,IN2); \ 430 } else if(!strncmp(OP, "&", 1)) { \ 431 if (PS_IS_PSELEMTYPE_INT(IN1->type) && PS_IS_PSELEMTYPE_INT(IN2->type)) { \ 432 BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,(*i1) & (*i2),IN2); \ 433 } else { \ 434 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 435 "Types (%x,%x) are not appropriate for logical AND.\n", IN1->type, IN2->type); \ 436 return NULL; \ 437 } \ 438 } else if(!strncmp(OP, "|", 1)) { \ 439 if (PS_IS_PSELEMTYPE_INT(IN1->type) && PS_IS_PSELEMTYPE_INT(IN2->type)) { \ 440 BINARY_TYPE_INTEGER(DIM1,DIM2,OUT,IN1,(*i1) | (*i2),IN2); \ 441 } else { \ 442 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 443 "Types (%x,%x) are not appropriate for logical OR.\n", IN1->type, IN2->type); \ 444 return NULL; \ 445 } \ 390 446 } else if(!strncmp(OP, "^", 1)) { \ 391 447 if(PS_IS_PSELEMTYPE_COMPLEX(IN1->type)) { \
Note:
See TracChangeset
for help on using the changeset viewer.
