Changeset 1172
- Timestamp:
- Jul 1, 2004, 11:48:11 AM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
collections/psBitSet.c (modified) (8 diffs)
-
collections/psBitSet.h (modified) (2 diffs)
-
types/psBitSet.c (modified) (8 diffs)
-
types/psBitSet.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psBitSet.c
r1167 r1172 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-01 00:57:31 $12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-07-01 21:48:11 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 86 86 87 87 if(n <= 0) { 88 psError(__func__, " : Line %d - Allocation size must be > 0: size = %d \n", __LINE__, n);88 psError(__func__, " : Line %d - Allocation size must be > 0: size = %d", __LINE__, n); 89 89 return 0; 90 90 } … … 113 113 { 114 114 if(inBitSet == NULL) { 115 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument \n", __LINE__);115 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 116 116 return; 117 117 } … … 124 124 125 125 if(inBitSet == NULL) { 126 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument \n", __LINE__);126 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 127 127 return inBitSet; 128 128 } else if(bit < 0) { 129 psError(__func__, " : Line %d - Bit position too small: %d \n", __LINE__, bit);129 psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit); 130 130 return inBitSet; 131 131 } else if(bit > inBitSet->n*8-1) { 132 psError(__func__, " : Line %d - Bit position too large: %d \n", __LINE__, bit);132 psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit); 133 133 return inBitSet; 134 134 } … … 146 146 147 147 if(inBitSet == NULL) { 148 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument \n", __LINE__);148 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 149 149 return 0; 150 150 } else if(bit < 0) { 151 psError(__func__, " : Line %d - Bit position too small: %d \n", __LINE__, bit);151 psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit); 152 152 return 0; 153 153 } else if(bit > inBitSet->n*8-1) { 154 psError(__func__, " : Line %d - Bit position too large: %d \n", __LINE__, bit);154 psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit); 155 155 return 0; 156 156 } … … 175 175 char *inBits2 = NULL; 176 176 177 if(outBitSet == NULL) {178 psError(__func__, " : Line %d - Null psBitSet for outBitSet argument\n", __LINE__);179 return outBitSet;180 }181 182 177 if(inBitSet1 == NULL) { 183 psError(__func__, " : Line %d - Null psBitSet for inBitSet1 argument \n", __LINE__);178 psError(__func__, " : Line %d - Null psBitSet for inBitSet1 argument", __LINE__); 184 179 return outBitSet; 185 180 } … … 191 186 192 187 if(inBitSet2 == NULL) { 193 psError(__func__, " : Line %d - Null psBitSet for inBitSet2 argument\n", __LINE__); 194 return outBitSet; 188 psError(__func__, " : Line %d - Null psBitSet for inBitSet2 argument", __LINE__); 189 return outBitSet; 190 } 191 192 if(outBitSet == NULL) { 193 outBitSet = psBitSetAlloc(inBitSet1->n*8); 195 194 } 196 195 197 196 if(inBitSet1->n != inBitSet2->n || outBitSet->n != inBitSet1->n) { 198 psError(__func__, " : Line %d - psBitSet sizes not the same \n", __LINE__);197 psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__); 199 198 return outBitSet; 200 199 } … … 223 222 break; 224 223 default: 225 psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s\n", __LINE__, operator); 224 psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s", __LINE__, operator); 225 } 226 227 return outBitSet; 228 } 229 230 psBitSet* psBitSetNot(psBitSet *outBitSet, const psBitSet *restrict inBitSet) 231 { 232 int i = 0; 233 int n = 0; 234 char *outBits = NULL; 235 char *inBits = NULL; 236 237 if(inBitSet == NULL) { 238 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 239 return outBitSet; 240 } 241 242 n = inBitSet->n; 243 if(n == 0) { 244 psError(__func__, " : Line %d - No elements in inBitSet", __LINE__); 245 return outBitSet; 246 } 247 248 if(outBitSet == NULL) { 249 outBitSet = psBitSetAlloc(n*8); 250 } 251 252 if(inBitSet->n != outBitSet->n) { 253 psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__); 254 return outBitSet; 255 } 256 257 outBits = outBitSet->bits; 258 inBits = inBitSet->bits; 259 260 for(i=0; i<n; i++) { 261 outBits[i] = ~inBits[i]; 226 262 } 227 263 -
trunk/psLib/src/collections/psBitSet.h
r1166 r1172 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-07-01 00:45:32$14 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-07-01 21:48:11 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 97 97 ); 98 98 99 /** Perform a not operation on a psBitSet 100 * 101 * Toggles bits in a psBitset. All zero bits are set to one and all one bits are set to zero. 102 * 103 * @return psBitSet*: Pointer to struct containing result of operation. 104 */ 105 psBitSet* psBitSetNot( 106 psBitSet *outBitSet, /**< Resulting psBitSet from operation */ 107 const psBitSet *restrict inBitSet /**< Input psBitSet */ 108 ); 109 99 110 /** Convert the psBitSet to a string of ones and zeros. 100 111 * -
trunk/psLib/src/types/psBitSet.c
r1167 r1172 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-01 00:57:31 $12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-07-01 21:48:11 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 86 86 87 87 if(n <= 0) { 88 psError(__func__, " : Line %d - Allocation size must be > 0: size = %d \n", __LINE__, n);88 psError(__func__, " : Line %d - Allocation size must be > 0: size = %d", __LINE__, n); 89 89 return 0; 90 90 } … … 113 113 { 114 114 if(inBitSet == NULL) { 115 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument \n", __LINE__);115 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 116 116 return; 117 117 } … … 124 124 125 125 if(inBitSet == NULL) { 126 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument \n", __LINE__);126 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 127 127 return inBitSet; 128 128 } else if(bit < 0) { 129 psError(__func__, " : Line %d - Bit position too small: %d \n", __LINE__, bit);129 psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit); 130 130 return inBitSet; 131 131 } else if(bit > inBitSet->n*8-1) { 132 psError(__func__, " : Line %d - Bit position too large: %d \n", __LINE__, bit);132 psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit); 133 133 return inBitSet; 134 134 } … … 146 146 147 147 if(inBitSet == NULL) { 148 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument \n", __LINE__);148 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 149 149 return 0; 150 150 } else if(bit < 0) { 151 psError(__func__, " : Line %d - Bit position too small: %d \n", __LINE__, bit);151 psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit); 152 152 return 0; 153 153 } else if(bit > inBitSet->n*8-1) { 154 psError(__func__, " : Line %d - Bit position too large: %d \n", __LINE__, bit);154 psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit); 155 155 return 0; 156 156 } … … 175 175 char *inBits2 = NULL; 176 176 177 if(outBitSet == NULL) {178 psError(__func__, " : Line %d - Null psBitSet for outBitSet argument\n", __LINE__);179 return outBitSet;180 }181 182 177 if(inBitSet1 == NULL) { 183 psError(__func__, " : Line %d - Null psBitSet for inBitSet1 argument \n", __LINE__);178 psError(__func__, " : Line %d - Null psBitSet for inBitSet1 argument", __LINE__); 184 179 return outBitSet; 185 180 } … … 191 186 192 187 if(inBitSet2 == NULL) { 193 psError(__func__, " : Line %d - Null psBitSet for inBitSet2 argument\n", __LINE__); 194 return outBitSet; 188 psError(__func__, " : Line %d - Null psBitSet for inBitSet2 argument", __LINE__); 189 return outBitSet; 190 } 191 192 if(outBitSet == NULL) { 193 outBitSet = psBitSetAlloc(inBitSet1->n*8); 195 194 } 196 195 197 196 if(inBitSet1->n != inBitSet2->n || outBitSet->n != inBitSet1->n) { 198 psError(__func__, " : Line %d - psBitSet sizes not the same \n", __LINE__);197 psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__); 199 198 return outBitSet; 200 199 } … … 223 222 break; 224 223 default: 225 psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s\n", __LINE__, operator); 224 psError(__func__, " : Line %d - Invalid psBitMask binary operation: %s", __LINE__, operator); 225 } 226 227 return outBitSet; 228 } 229 230 psBitSet* psBitSetNot(psBitSet *outBitSet, const psBitSet *restrict inBitSet) 231 { 232 int i = 0; 233 int n = 0; 234 char *outBits = NULL; 235 char *inBits = NULL; 236 237 if(inBitSet == NULL) { 238 psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__); 239 return outBitSet; 240 } 241 242 n = inBitSet->n; 243 if(n == 0) { 244 psError(__func__, " : Line %d - No elements in inBitSet", __LINE__); 245 return outBitSet; 246 } 247 248 if(outBitSet == NULL) { 249 outBitSet = psBitSetAlloc(n*8); 250 } 251 252 if(inBitSet->n != outBitSet->n) { 253 psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__); 254 return outBitSet; 255 } 256 257 outBits = outBitSet->bits; 258 inBits = inBitSet->bits; 259 260 for(i=0; i<n; i++) { 261 outBits[i] = ~inBits[i]; 226 262 } 227 263 -
trunk/psLib/src/types/psBitSet.h
r1166 r1172 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-07-01 00:45:32$14 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-07-01 21:48:11 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 97 97 ); 98 98 99 /** Perform a not operation on a psBitSet 100 * 101 * Toggles bits in a psBitset. All zero bits are set to one and all one bits are set to zero. 102 * 103 * @return psBitSet*: Pointer to struct containing result of operation. 104 */ 105 psBitSet* psBitSetNot( 106 psBitSet *outBitSet, /**< Resulting psBitSet from operation */ 107 const psBitSet *restrict inBitSet /**< Input psBitSet */ 108 ); 109 99 110 /** Convert the psBitSet to a string of ones and zeros. 100 111 *
Note:
See TracChangeset
for help on using the changeset viewer.
