Commits

Bob Harris  committed 613483e

changed binBitsSetRange to leave ALL_ONE bins as is; may reduce memory footprint when long ranges are set (longer than a bin)

  • Participants
  • Parent commits 86df2b6

Comments (0)

Files changed (1)

File src/binBits.c

     {
         bin = binBitsGetBin( bb, start );  
         offset = binBitsGetOffset( bb, start );
+        delta = bb->bin_size - offset;
         if ( bb->bins[bin] == ALL_ZERO )
         {
             bb->bins[bin] = bitAlloc( bb->bin_size );   
         }
-        else if ( bb->bins[bin] == ALL_ONE )
-        {
-            bb->bins[bin] = bitAlloc( bb->bin_size );
-            bitSetRange( bb->bins[bin], 0, bb->bin_size );
-        }
-        delta = bb->bin_size - offset;
         if ( delta < size )
         {
-            bitSetRange( bb->bins[bin], offset, delta );
+            if ( bb->bins[bin] != ALL_ONE )
+            {
+                bitSetRange( bb->bins[bin], offset, delta );
+            }
             size -= delta;
             start += delta;
         }
         else
         {
-            bitSetRange( bb->bins[bin], offset, size );
+            if ( bb->bins[bin] != ALL_ONE )
+            {
+                bitSetRange( bb->bins[bin], offset, size );
+            }
             size = 0;
         }
     }