Changeset 5530 for trunk/psLib/src/mathtypes
- Timestamp:
- Nov 16, 2005, 1:07:10 PM (20 years ago)
- Location:
- trunk/psLib/src/mathtypes
- Files:
-
- 3 edited
-
psImage.h (modified) (2 diffs)
-
psVector.c (modified) (4 diffs)
-
psVector.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.h
r5137 r5530 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.7 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005- 09-26 22:35:53$13 * @version $Revision: 1.73 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-11-16 23:06:21 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 80 80 psImage; 81 81 82 /** Basic image region structure. 83 * 84 * Struct for specifying a rectangular area in an image. 85 * 86 */ 87 typedef struct 88 { 89 float x0; ///< the first column of the region. 90 float x1; ///< the last column of the region. 91 float y0; ///< the first row of the region. 92 float y1; ///< the last row of the region. 93 } 94 psRegion; 82 #define P_PSIMAGE_SET_NUMCOLS(img,nc) *(int*)&img->numCols = nc 83 #define P_PSIMAGE_SET_NUMROWS(img,nr) *(int*)&img->numCols = nr 84 #define P_PSIMAGE_SET_TYPE(img,t) *(psMathType*)&img->type = t 85 86 /** Basic image region structure. 87 * 88 * Struct for specifying a rectangular area in an image. 89 * 90 */ 91 typedef struct 92 { 93 float x0; ///< the first column of the region. 94 float x1; ///< the last column of the region. 95 float y0; ///< the first row of the region. 96 float y1; ///< the last row of the region. 97 } 98 psRegion; 95 99 96 100 /** Create an image of the specified size and type. -
trunk/psLib/src/mathtypes/psVector.c
r5222 r5530 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 0-04 01:31:40$11 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-16 23:06:21 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 87 87 psVec->type.dimen = PS_DIMEN_VECTOR; 88 88 psVec->type.type = type; 89 *(long*)&psVec->nalloc = nalloc;89 P_PSVECTOR_SET_NALLOC(psVec,nalloc); 90 90 psVec->n = nalloc; 91 91 … … 114 114 // Realloc after decrementation to avoid accessing freed array elements 115 115 vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize); 116 *(long*)&vector->nalloc = nalloc;116 P_PSVECTOR_SET_NALLOC(vector,nalloc); 117 117 } 118 118 … … 143 143 if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) { 144 144 vector->data.U8 = psRealloc(vector->data.U8, byteSize); 145 *(long*)&vector->nalloc = nalloc;145 P_PSVECTOR_SET_NALLOC(vector,nalloc); 146 146 } 147 147 -
trunk/psLib/src/mathtypes/psVector.h
r5137 r5530 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 49$ $Name: not supported by cvs2svn $14 * @date $Date: 2005- 09-26 22:35:53$13 * @version $Revision: 1.50 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-11-16 23:06:21 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 55 55 psVector; 56 56 57 /*****************************************************************************/ 58 59 /* FUNCTION PROTOTYPES */ 60 61 /*****************************************************************************/ 62 63 /** Checks the type of a particular pointer. 64 * 65 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 66 * 67 * @return bool: True if the pointer matches a psVector structure, false otherwise. 68 */ 69 bool psMemCheckVector( 70 psPtr ptr ///< the pointer whose type to check 71 ) 72 ; 57 #define P_PSVECTOR_SET_NALLOC(vec,n) *(long*)&(vec->nalloc) = n 58 59 /*****************************************************************************/ 60 61 /* FUNCTION PROTOTYPES */ 62 63 /*****************************************************************************/ 64 65 /** Checks the type of a particular pointer. 66 * 67 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 68 * 69 * @return bool: True if the pointer matches a psVector structure, false otherwise. 70 */ 71 bool psMemCheckVector( 72 psPtr ptr ///< the pointer whose type to check 73 ) 74 ; 73 75 74 76 /** Allocate a vector.
Note:
See TracChangeset
for help on using the changeset viewer.
