Changeset 1820
- Timestamp:
- Sep 16, 2004, 1:47:43 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
collections/psVector.c (modified) (2 diffs)
-
mathtypes/psVector.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psVector.c
r1807 r1820 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-09-1 4 20:01:52$12 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-09-16 23:47:43 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 } 89 89 90 psVector* psVectorRecycle(psVector* restrict in, unsigned int n alloc, psElemType type)91 { 92 psElemType elemType;90 psVector* psVectorRecycle(psVector* restrict in, unsigned int n, psElemType type) 91 { 92 int byteSize; 93 93 94 94 if (in == NULL) { 95 return psVectorAlloc(nalloc, type); 96 } 97 98 elemType = in->type.type; 99 100 if (in->nalloc == nalloc && elemType == type) { 101 // it is proper size/type already 102 return in; 103 } 104 105 in->data.V = psRealloc(in->data.V, nalloc * PSELEMTYPE_SIZEOF(type)); 95 return psVectorAlloc(n, type); 96 } 97 98 byteSize = n * PSELEMTYPE_SIZEOF(type); 99 100 // need to increase data buffer? 101 if (byteSize > in->nalloc*PSELEMTYPE_SIZEOF(in->type.type)) { 102 in->data.V = psRealloc(in->data.V, byteSize); 103 in->nalloc = n; 104 } 106 105 107 106 in->type.type = type; 108 in->nalloc = nalloc; 109 in->n = nalloc; 107 in->n = n; 110 108 111 109 return in; -
trunk/psLib/src/mathtypes/psVector.c
r1807 r1820 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-09-1 4 20:01:52$12 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-09-16 23:47:43 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 } 89 89 90 psVector* psVectorRecycle(psVector* restrict in, unsigned int n alloc, psElemType type)91 { 92 psElemType elemType;90 psVector* psVectorRecycle(psVector* restrict in, unsigned int n, psElemType type) 91 { 92 int byteSize; 93 93 94 94 if (in == NULL) { 95 return psVectorAlloc(nalloc, type); 96 } 97 98 elemType = in->type.type; 99 100 if (in->nalloc == nalloc && elemType == type) { 101 // it is proper size/type already 102 return in; 103 } 104 105 in->data.V = psRealloc(in->data.V, nalloc * PSELEMTYPE_SIZEOF(type)); 95 return psVectorAlloc(n, type); 96 } 97 98 byteSize = n * PSELEMTYPE_SIZEOF(type); 99 100 // need to increase data buffer? 101 if (byteSize > in->nalloc*PSELEMTYPE_SIZEOF(in->type.type)) { 102 in->data.V = psRealloc(in->data.V, byteSize); 103 in->nalloc = n; 104 } 106 105 107 106 in->type.type = type; 108 in->nalloc = nalloc; 109 in->n = nalloc; 107 in->n = n; 110 108 111 109 return in;
Note:
See TracChangeset
for help on using the changeset viewer.
