struct cache_savepoint {
guchar *processed_bits;
guint processed_num;
+ guint pass;
+ gint offset;
};
gboolean
/* Inverse to use ffs */
memset (checkpoint->processed_bits, 0xff, NBYTES (cache->used_items));
checkpoint->processed_num = 0;
+ checkpoint->pass = 0;
+ checkpoint->offset = 0;
*save = checkpoint;
}
else {
}
/* TODO: too slow approach */
- for (i = 0; i < (gint)cache->used_items; i ++) {
+ for (i = checkpoint->offset * NBBY; i < (gint)cache->used_items; i ++) {
if (isset (checkpoint->processed_bits, i)) {
idx = i;
break;
}
}
+ if (idx >= (checkpoint->offset + 1) * NBBY) {
+ checkpoint->offset ++;
+ }
+
g_assert (idx >= 0 && idx < (gint)cache->items_by_order->len);
item = g_ptr_array_index (cache->items_by_order, idx);