}
}
-/* bitwise-ands same-sized maps t and s, stores the result in t. */
+/* bitwise-ands maps t and s, stores the result in t. */
void
map_and(Map *t, Map *s)
{
*ti++ &= *si++;
}
+/* bitwise-ors maps t and s, stores the result in t. */
+void
+map_or(Map *t, Map *s)
+{
+ unsigned char *ti, *si, *end;
+ if (t->size < s->size)
+ map_grow(t, s->size << 3);
+ ti = t->map;
+ si = s->map;
+ end = ti + (t->size < s->size ? t->size : s->size);
+ while (ti < end)
+ *ti++ |= *si++;
+}
+
/* remove all set bits in s from t. */
void
map_subtract(Map *t, Map *s)
extern void map_grow(Map *m, int n);
extern void map_free(Map *m);
extern void map_and(Map *t, Map *s);
+extern void map_or(Map *t, Map *s);
extern void map_subtract(Map *t, Map *s);
static inline void map_empty(Map *m)
map_grow;
map_init;
map_init_clone;
+ map_or;
policy_filter_unwanted;
policy_findupdatepackages;
policy_illegal2str;
queue_insert;
queue_insert2;
queue_insertn;
+ queue_prealloc;
repo_add_deparray;
repo_add_idarray;
repo_add_poolstr_array;
q->left += n;
q->count -= n;
}
+
+/* allocate room for n more elements */
+void
+queue_prealloc(Queue *q, int n)
+{
+ int off;
+ if (n <= 0 || q->left >= n)
+ return;
+ if (!q->alloc)
+ queue_alloc_one(q);
+ off = q->elements - q->alloc;
+ q->alloc = solv_realloc2(q->alloc, off + q->count + n + EXTRA_SPACE, sizeof(Id));
+ q->elements = q->alloc + off;
+ q->left = n + EXTRA_SPACE;
+}
+
extern void queue_delete(Queue *q, int pos);
extern void queue_delete2(Queue *q, int pos);
extern void queue_deleten(Queue *q, int pos, int n);
+extern void queue_prealloc(Queue *q, int n);
#endif /* LIBSOLV_QUEUE_H */
nrequires = solv_calloc(count, sizeof(Id));
queue_init(&edges);
- /* pre-size */
- queue_insertn(&edges, 0, count * 4 + 10);
- queue_empty(&edges);
+ queue_prealloc(&edges, count * 4 + 10); /* pre-size */
/*
* Go through the solvables in the nodes queue and create edges for