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;
     }
