Index: trunk/psLib/src/collections/psBitSet.c
===================================================================
--- trunk/psLib/src/collections/psBitSet.c	(revision 952)
+++ trunk/psLib/src/collections/psBitSet.c	(revision 965)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-09 21:18:24 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-10 00:29:09 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,4 +22,5 @@
 #include <stdio.h>
 #include <ctype.h>
+#include <math.h>
 
 #include "psBitSet.h"
@@ -77,4 +78,5 @@
 psBitSet* psBitSetAlloc(int n)
 {
+    int numBytes = 0;
     psBitSet *newObj = NULL;
 
@@ -84,11 +86,12 @@
     }
 
+    numBytes = ceil(n/8.0);
     newObj = psAlloc(sizeof(psBitSet));
-    newObj->n = n;
+    newObj->n = numBytes;
 
     // Ignore splint warning about releasing pointer members, since they've not been allocated yet
     /*@i@*/
-    newObj->bits = psAlloc(sizeof(char)*n);
-    memset(newObj->bits, n, 0);
+    newObj->bits = psAlloc(sizeof(char)*numBytes);
+    memset(newObj->bits, numBytes, 0);
 
     return newObj;
@@ -113,5 +116,8 @@
         return inBitSet;
     } else if(bit < 0) {
-        psError(__func__, " : Line %d - Negative bit position not allowed: %d\n", __LINE__, bit);
+        psError(__func__, " : Line %d - Bit position too small: %d\n", __LINE__, bit);
+        return inBitSet;
+    } else if(bit > inBitSet->n*8-1) {
+        psError(__func__, " : Line %d - Bit position too large: %d\n", __LINE__, bit);
         return inBitSet;
     }
@@ -132,5 +138,8 @@
         return 0;
     } else if(bit < 0) {
-        psError(__func__, " : Line %d - Negative bit position not allowed: %d\n", __LINE__, bit);
+        psError(__func__, " : Line %d - Bit position too small: %d\n", __LINE__, bit);
+        return 0;
+    } else if(bit > inBitSet->n*8-1) {
+        psError(__func__, " : Line %d - Bit position too large: %d\n", __LINE__, bit);
         return 0;
     }
Index: trunk/psLib/src/collections/psBitSet.h
===================================================================
--- trunk/psLib/src/collections/psBitSet.h	(revision 952)
+++ trunk/psLib/src/collections/psBitSet.h	(revision 965)
@@ -4,12 +4,12 @@
  *
  *  Bit masks are useful tools for toggling various flags and options. This set of functions module provides
- *  a mechanism to create an array of bits of arbitrary length and manipulate them with basic binary 
+ *  a mechanism to create an array of bits of arbitrary length and manipulate them with basic binary
  *  operations. A print function is also provided to display the entire set of bits in binary format as a
  *  string.
  *
  *  @author Ross Harman, MHPCC
- *   
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-05-08 00:08:27 $
+ *
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-10 00:28:58 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -25,5 +25,5 @@
 /** Struct containing array of bytes to hold bit data and corresponding array length.
  *
- *  The bits in the struct are assembled in as an array of bytes with eight bits per byte. The bits are 
+ *  The bits in the struct are assembled in as an array of bytes with eight bits per byte. The bits are
  *  arranged with the LSB in first (right most) position of the first array element.
  */
@@ -41,5 +41,5 @@
 /** Allocate a psBitSet.
  *
- *  Create a psBitSet with the number of bytes specified by the user. All bits are set to zero upon 
+ *  Create a psBitSet with the number of bytes specified by the user. All bits are set to zero upon
  *  allocation.
  *
@@ -48,5 +48,5 @@
 /*@null@*/
 psBitSet* psBitSetAlloc(
-    int n   /**< Number of bytes in psBitSet array */
+    int n   /**< Number of bits in psBitSet array */
 );
 
@@ -61,5 +61,5 @@
 /** Set a bit.
  *
- *  Sets a bit at a given bit location, either one or zero. The bit is set based on a zero index with the 
+ *  Sets a bit at a given bit location, either one or zero. The bit is set based on a zero index with the
  *  first bit set in the zero bit slot of the zero element of the byte array. As an example, setting bit 3 in
  *  an array with two elements would result in an psBitSet that looks like 00000000 00001000.
@@ -74,6 +74,6 @@
 /** Test the value of a bit.
  *
- *  Prints the value of a bit at a given bit location, either one or zero. The resulting bit is based on a 
- *  zero index format with the first bit set in the zero bit slot of the zero element of the byte array 
+ *  Prints the value of a bit at a given bit location, either one or zero. The resulting bit is based on a
+ *  zero index format with the first bit set in the zero bit slot of the zero element of the byte array
  *  As an example, testing bit 3 in a psBitSet with two bytes that looks like 00000000 00001000 would return a
  *  value of one, since that is the value that was set.
