IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8387


Ignore:
Timestamp:
Aug 16, 2006, 10:36:04 AM (20 years ago)
Author:
Paul Price
Message:

Putting brackets around macro parameters.

File:
1 edited

Legend:

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

    r7766 r8387  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-06-30 02:20:06 $
     13 *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-08-16 20:36:04 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    295295    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    296296            "psVector %s: bad type(%d)", \
    297             #NAME, NAME->type.type); \
     297            #NAME, (NAME)->type.type); \
    298298    return(RVAL); \
    299299} \
     
    303303    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    304304            "psVector %s: bad type(%d)", \
    305             #NAME, NAME->type.type); \
     305            #NAME, (NAME)->type.type); \
    306306    return(RVAL); \
    307307} \
     
    316316
    317317#define PS_ASSERT_VECTORS_SIZE_EQUAL(VEC1, VEC2, RVAL) \
    318 if (VEC1->n != VEC2->n) { \
     318if ((VEC1)->n != (VEC2)->n) { \
    319319    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    320320            "psVector %s has size %d, psVector %s has size %d.", \
    321             #VEC1, VEC1->n, #VEC2, VEC2->n); \
     321            #VEC1, (VEC1)->n, #VEC2, (VEC2)->n); \
    322322    return(RVAL); \
    323323}
    324324
    325325#define PS_ASSERT_VECTOR_SIZE(VEC, SIZE, RVAL) \
    326 if (VEC->n != SIZE) { \
     326if ((VEC)->n != (SIZE)) { \
    327327    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    328328            "psVector %s has size %d, should be %d.", \
    329             #VEC, VEC->n, SIZE); \
     329            #VEC, (VEC)->n, (SIZE)); \
    330330    return(RVAL); \
    331331}
    332332
    333333#define PS_ASSERT_VECTOR_TYPE_EQUAL(VEC1, VEC2, RVAL) \
    334 if (VEC1->type.type != VEC2->type.type) { \
     334if ((VEC1)->type.type != (VEC2)->type.type) { \
    335335    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    336336            "psVector %s has size %d, psVector %s has size %d.", \
    337             #VEC1, VEC1->type.type, #VEC2, VEC2->type.type); \
     337            #VEC1, (VEC1)->type.type, #VEC2, (VEC2)->type.type); \
    338338    return(RVAL); \
    339339}
    340340
    341341#define PS_VECTOR_PRINT_F32(NAME) \
    342 if (NAME != NULL) { \
    343     for (int my_i=0;my_i<(NAME)->n;my_i++) { \
    344         printf("%s->data.F32[%d] is %f\n", #NAME, my_i, (NAME)->data.F32[my_i]); \
     342if ((NAME) != NULL) { \
     343    for (int i = 0; i < (NAME)->n; i++) { \
     344        printf("%s->data.F32[%d] is %f\n", #NAME, i, (NAME)->data.F32[i]); \
    345345    } \
    346346    printf("\n"); \
     
    350350
    351351#define PS_VECTOR_PRINT_F64(NAME) \
    352 if (NAME != NULL) { \
    353     for (int my_i=0;my_i<(NAME)->n;my_i++) { \
    354         printf("%s->data.F64[%d] is %f\n", #NAME, my_i, (NAME)->data.F64[my_i]); \
     352if ((NAME) != NULL) { \
     353    for (int i = 0; i < (NAME)->n; i++) { \
     354        printf("%s->data.F64[%d] is %f\n", #NAME, i, (NAME)->data.F64[i]); \
    355355    } \
    356356    printf("\n"); \
Note: See TracChangeset for help on using the changeset viewer.