Changeset 11708
- Timestamp:
- Feb 8, 2007, 11:33:57 AM (19 years ago)
- Location:
- trunk/psLib/src/types
- Files:
-
- 2 edited
-
psBitSet.c (modified) (4 diffs)
-
psBitSet.h (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psBitSet.c
r10999 r11708 11 11 * @author Robert DeSonia, MHPCC 12 12 * 13 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $14 * @date $Date: 2007-0 1-09 22:38:53$13 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-02-08 21:33:57 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 75 75 76 76 77 psBitSet* psBitSetAlloc(long nalloc) 77 psBitSet* p_psBitSetAlloc(const char *file, 78 unsigned int lineno, 79 const char *func, 80 long nalloc) 78 81 { 79 82 if (nalloc < 0) { … … 88 91 89 92 numBytes = ceil(nalloc / 8.0); 90 newObj = p sAlloc(sizeof(psBitSet));93 newObj = p_psAlloc(file, lineno, func, sizeof(psBitSet)); 91 94 psMemSetDeallocator(newObj, (psFreeFunc) bitSetFree); 92 95 newObj->n = numBytes; … … 100 103 return newObj; 101 104 } 105 102 106 103 107 psBitSet* psBitSetSet(psBitSet* bitSet, -
trunk/psLib/src/types/psBitSet.h
r11248 r11708 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2007-0 1-23 22:47:23$13 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-02-08 21:33:57 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 49 49 /** Checks the type of a particular pointer. 50 50 * 51 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 51 * Uses the appropriate deallocation function in psMemBlock to check the ptr 52 * datatype. 52 53 * 53 54 * @return bool: True if the pointer matches a psBitSet structure, false otherwise. … … 55 56 bool psMemCheckBitSet( 56 57 psPtr ptr ///< the pointer whose type to check 57 ) 58 ; 58 ); 59 59 60 60 61 /** Allocate a psBitSet. 61 62 * 62 * Create a psBitSet with the number of bits specified by the user. All bits are set63 * to zero upon allocation.63 * Create a psBitSet with the number of bits specified by the user. All bits 64 * are set to zero upon allocation. 64 65 * 65 66 * @return psBitSet* : Pointer to struct containing array of bits and size of array. 66 67 */ 68 #ifdef DOXYGEN 67 69 psBitSet* psBitSetAlloc( 68 70 long nalloc ///< Number of bits in psBitSet array 69 71 ); 72 #else // ifdef DOXYGEN 73 psBitSet* p_psBitSetAlloc( 74 const char *file, ///< File of caller 75 unsigned int lineno, ///< Line number of caller 76 const char *func, ///< Function name of caller 77 long nalloc ///< Number of bits in psBitSet array 78 ); 79 #define psBitSetAlloc(nalloc) \ 80 p_psBitSetAlloc(__FILE__, __LINE__, __func__, nalloc) 81 #endif // ifdef DOXYGEN 82 83 84 70 85 71 86 /** Set a bit. 72 87 * 73 * Sets a bit at a given bit location. The bit is set based on a zero index with the74 * first bit set in the zero bit slot of the zero element of the byte array. As an75 * example, setting bit 3 in an array with two elements would result in an psBitSet76 * that looks like 00000000 00001000.88 * Sets a bit at a given bit location. The bit is set based on a zero index 89 * with the first bit set in the zero bit slot of the zero element of the byte 90 * array. As an example, setting bit 3 in an array with two elements would 91 * result in an psBitSet that looks like 00000000 00001000. 77 92 * 78 93 * @return psBitSet* : Pointer to struct containing psBitSet. … … 82 97 long bit ///< Bit to be set. 83 98 ); 99 84 100 85 101 /** Clear a bit. … … 96 112 ); 97 113 114 98 115 /** Test the value of a bit. 99 116 * 100 * Prints the value of a bit at a given bit location, either one or zero. The resulting101 * bit is based on a zero index format with the first bit set in the zero bit slot of102 * the zero element of the byte array. As an example, testing bit 3 in a psBitSet with103 * t wo bytes that looks like 00000000 00001000 would return a value of one, since that104 * is the value that was set.117 * Prints the value of a bit at a given bit location, either one or zero. The 118 * resulting bit is based on a zero index format with the first bit set in the 119 * zero bit slot of the zero element of the byte array. As an example, 120 * testing bit 3 in a psBitSet with two bytes that looks like 00000000 121 * 00001000 would return a value of one, since that is the value that was set. 105 122 * 106 123 * @return bool: True if successful, otherwise false … … 111 128 ); 112 129 130 113 131 /** Perform a binary operation on two psBitSets 114 132 * 115 * Perform an AND, OR, or XOR on two psBitSets. If the BitMasks are not the same size, 116 * the operation will not be performed and an error message will be logged. 133 * Perform an AND, OR, or XOR on two psBitSets. If the BitMasks are not the 134 * same size, the operation will not be performed and an error message will be 135 * logged. 117 136 * 118 137 * @return psBitSet* : Pointer to struct containing result of binary operation. … … 125 144 ); 126 145 146 127 147 /** Perform a not operation on a psBitSet 128 148 * 129 * Toggles bits in a psBitset. All zero bits are set to one and all one bits are set130 * to zero.149 * Toggles bits in a psBitset. All zero bits are set to one and all one bits 150 * are set to zero. 131 151 * 132 152 * @return psBitSet* : Pointer to struct containing result of operation. … … 137 157 ); 138 158 159 139 160 /** Convert the psBitSet to a string of ones and zeros. 140 161 * 141 * Converts the contents of a psBitSet to a string representation of its binary form of142 * ones and zeros. The LSB is the right-most chracter. Each set of eight characters143 * represents one byte.162 * Converts the contents of a psBitSet to a string representation of its 163 * binary form of ones and zeros. The LSB is the right-most chracter. Each set 164 * of eight characters represents one byte. 144 165 * 145 166 * @return psString: Pointer to character array containing string data. … … 149 170 ); 150 171 172 151 173 /// @} 152 174 #endif // #ifndef PSBITSET_H
Note:
See TracChangeset
for help on using the changeset viewer.
