/* Determine number of bytes for each set. */
bytes = bitset_bytes (type, n_bits);
/* If size calculation overflows, memory is exhausted. */
if (BITSET_SIZE_MAX / (sizeof (bitset) + bytes) <= n_vecs)
xalloc_die ();
/* Determine number of bytes for each set. */
bytes = bitset_bytes (type, n_bits);
/* If size calculation overflows, memory is exhausted. */
if (BITSET_SIZE_MAX / (sizeof (bitset) + bytes) <= n_vecs)
xalloc_die ();
/* Allocate vector table at head of bitset array. */
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
vector_bytes -= vector_bytes % bytes;
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
/* Allocate vector table at head of bitset array. */
vector_bytes = (n_vecs + 1) * sizeof (bitset) + bytes - 1;
vector_bytes -= vector_bytes % bytes;
bsetv = (bitset *) xcalloc (1, vector_bytes + bytes * n_vecs);
for (i = 0; i < n_vecs; i++)
{
bsetv[i] = (bitset) (void *) ((char *) bsetv + vector_bytes + i * bytes);
for (i = 0; i < n_vecs; i++)
{
bsetv[i] = (bitset) (void *) ((char *) bsetv + vector_bytes + i * bytes);
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
attribute hints specified by ATTR. */
bitset *
/* Create a vector of N_VECS bitsets, each of N_BITS, and with
attribute hints specified by ATTR. */
bitset *
type = bitset_type_choose (n_bits, attr);
return bitsetv_alloc (n_vecs, n_bits, type);
}
type = bitset_type_choose (n_bits, attr);
return bitsetv_alloc (n_vecs, n_bits, type);
}
/* Given a vector BSETV of N bitsets of size N, modify its contents to
be the transitive closure of what was given. */
void
/* Given a vector BSETV of N bitsets of size N, modify its contents to
be the transitive closure of what was given. */
void
for (i = 0; bsetv[i]; i++)
for (j = 0; bsetv[j]; j++)
if (bitset_test (bsetv[j], i))
for (i = 0; bsetv[i]; i++)
for (j = 0; bsetv[j]; j++)
if (bitset_test (bsetv[j], i))
-bitsetv_dump (file, title, subtitle, bsetv)
- FILE *file;
- const char *title, *subtitle;
- bitset *bsetv;
+bitsetv_dump (FILE *file, char const *title, char const *subtitle,
+ bitsetv bsetv)
fprintf (file, "%s\n", title);
for (i = 0; bsetv[i]; i++)
{
fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
bitset_dump (file, bsetv[i]);
}
fprintf (file, "%s\n", title);
for (i = 0; bsetv[i]; i++)
{
fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
bitset_dump (file, bsetv[i]);
}
for (i = 0; bsetv[i]; i++)
{
fprintf (stderr, "%lu: ", (unsigned long) i);
debug_bitset (bsetv[i]);
}
for (i = 0; bsetv[i]; i++)
{
fprintf (stderr, "%lu: ", (unsigned long) i);
debug_bitset (bsetv[i]);
}