Changeset 4597
- Timestamp:
- Jul 22, 2005, 12:19:31 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 6 edited
-
mathtypes/psVector.c (modified) (11 diffs)
-
mathtypes/psVector.h (modified) (4 diffs)
-
types/psArray.c (modified) (3 diffs)
-
types/psArray.h (modified) (2 diffs)
-
types/psPixels.c (modified) (3 diffs)
-
types/psPixels.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psVector.c
r4540 r4597 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.4 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-07- 12 19:12:01$11 * @version $Revision: 1.47 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-07-22 22:18:23 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 30 30 typedef struct 31 31 { 32 p_psVectorData data; // need this first for psVectorSortIndex to work. 32 union { 33 psU8* U8; ///< Unsigned 8-bit integer data. 34 psU16* U16; ///< Unsigned 16-bit integer data. 35 psU32* U32; ///< Unsigned 32-bit integer data. 36 psU64* U64; ///< Unsigned 64-bit integer data. 37 psS8* S8; ///< Signed 8-bit integer data. 38 psS16* S16; ///< Signed 16-bit integer data. 39 psS32* S32; ///< Signed 32-bit integer data. 40 psS64* S64; ///< Signed 64-bit integer data. 41 psF32* F32; ///< Single-precision float data. 42 psF64* F64; ///< Double-precision float data. 43 psC32* C32; ///< Single-precision complex data. 44 psC64* C64; ///< Double-precision complex data. 45 } data; 33 46 psU32 index; 34 47 } … … 48 61 // FUNCTION IMPLEMENTATION - PUBLIC 49 62 50 psVector* psVectorAlloc( long nalloc, psElemType type) 63 psVector* psVectorAlloc(long nalloc, 64 psElemType type) 51 65 { 52 66 psVector* psVec = NULL; … … 76 90 } 77 91 78 psVector* psVectorRealloc(psVector* vector, long nalloc) 92 psVector* psVectorRealloc(psVector* vector, 93 long nalloc) 79 94 { 80 95 psS32 elementSize = 0; … … 99 114 } 100 115 101 psVector* psVectorRecycle(psVector* vector, long nalloc, psElemType type) 116 psVector* psVectorRecycle(psVector* vector, 117 long nalloc, 118 psElemType type) 102 119 { 103 120 psS32 byteSize; … … 129 146 } 130 147 131 psVector *psVectorExtend(psVector *vector, long delta, long nExtend) 148 psVector *psVectorExtend(psVector *vector, 149 long delta, 150 long nExtend) 132 151 { 133 152 // can't handle a NULL vector (don't know the data type to allocate) … … 166 185 } 167 186 168 psVector* psVectorCopy(psVector* output, const psVector* input, psElemType type) 187 psVector* psVectorCopy(psVector* output, 188 const psVector* input, 189 psElemType type) 169 190 { 170 191 if (input == NULL) { … … 267 288 } 268 289 269 psVector* psVectorSort(psVector* outVector, const psVector* inVector) 290 psVector* psVectorSort(psVector* outVector, 291 const psVector* inVector) 270 292 { 271 293 psS32 N = 0; … … 353 375 } 354 376 355 psVector* psVectorSortIndex(psVector* outVector, const psVector* inVector) 377 psVector* psVectorSortIndex(psVector* outVector, 378 const psVector* inVector) 356 379 { 357 380 psS32 N = 0; … … 437 460 } 438 461 439 char* psVectorToString(psVector* vector, int maxLength) 462 char* psVectorToString(psVector* vector, 463 int maxLength) 440 464 { 441 465 … … 570 594 } 571 595 572 bool p_psVectorPrint (FILE *f, psVector *a, char *name) 596 bool p_psVectorPrint (FILE *f, 597 psVector *a, 598 char *name) 573 599 { 574 600 -
trunk/psLib/src/mathtypes/psVector.h
r4540 r4597 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-07- 12 19:12:01$13 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-07-22 22:18:18 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 ///< Union of psVector data types. 30 /* 30 31 typedef union { 31 32 psU8* U8; ///< Unsigned 8-bit integer data. … … 43 44 } 44 45 p_psVectorData; 45 46 */ 46 47 /** An vector to support primitive types. 47 48 * … … 54 55 long n; ///< Number of elements in use. 55 56 const long nalloc; ///< Total number of elements available. 56 p_psVectorData data; ///< Union for data types. 57 union { 58 psU8* U8; ///< Unsigned 8-bit integer data. 59 psU16* U16; ///< Unsigned 16-bit integer data. 60 psU32* U32; ///< Unsigned 32-bit integer data. 61 psU64* U64; ///< Unsigned 64-bit integer data. 62 psS8* S8; ///< Signed 8-bit integer data. 63 psS16* S16; ///< Signed 16-bit integer data. 64 psS32* S32; ///< Signed 32-bit integer data. 65 psS64* S64; ///< Signed 64-bit integer data. 66 psF32* F32; ///< Single-precision float data. 67 psF64* F64; ///< Double-precision float data. 68 psC32* C32; ///< Single-precision complex data. 69 psC64* C64; ///< Double-precision complex data. 70 } data; 57 71 void *lock; ///< Optional lock for thread safety. 58 72 } -
trunk/psLib/src/types/psArray.c
r4556 r4597 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-07- 15 02:33:54$11 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-07-22 22:19:12 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 57 57 psMemSetDeallocator(psArr, (psFreeFunc) arrayFree); 58 58 59 psArr->nalloc = nalloc;59 *(long*)&psArr->nalloc = nalloc; 60 60 psArr->n = nalloc; 61 61 … … 80 80 // Realloc after decrementation to avoid accessing freed array elements 81 81 in->data = psRealloc(in->data, nalloc * sizeof(psPtr)); 82 in->nalloc = nalloc;82 *(long*)&in->nalloc = nalloc; 83 83 } 84 84 -
trunk/psLib/src/types/psArray.h
r4556 r4597 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-07- 15 02:33:54$14 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-22 22:19:17 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 34 34 typedef struct 35 35 { 36 long nalloc; ///< Total number of elements available.37 36 long n; ///< Number of elements in use. 37 const long nalloc; ///< Total number of elements available. 38 38 psPtr* data; ///< An Array of pointer elements 39 39 void *lock; ///< Optional lock for thread safety -
trunk/psLib/src/types/psPixels.c
r4556 r4597 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-07- 15 02:33:54$9 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-22 22:19:27 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 65 65 } 66 66 out->n = nalloc; 67 out->nalloc = nalloc;67 *(long*)&out->nalloc = nalloc; 68 68 69 69 psMemSetDeallocator(out, (psFreeFunc)pixelsFree); … … 85 85 } 86 86 87 pixels->nalloc = nalloc;87 *(long*)&pixels->nalloc = nalloc; 88 88 89 89 if (pixels->n > pixels->nalloc) { -
trunk/psLib/src/types/psPixels.h
r4556 r4597 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-07- 15 02:33:54$9 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-22 22:19:31 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 42 42 { 43 43 long n; ///< Number in usa 44 long nalloc;///< Number allocated44 const long nalloc; ///< Number allocated 45 45 psPixelCoord* data; ///< The pixel coordinates 46 46 void *lock; ///< Option lock for thread safety
Note:
See TracChangeset
for help on using the changeset viewer.
