parse/bitset.c
/* Equalizes the size of a and b by
 * growing the smaller to the size of the
 * larger, zeroing out the new elements.
 * This allows the code to simply iterate
 * over both without keeping track of the
 * minimum size.
 */
Equalizes the size of a and b by
growing the smaller to the size of the
larger, zeroing out the new elements.
This allows the code to simply iterate
over both without keeping track of the
minimum size.
Equalizes the size of a and b by growing the smaller to the size of the larger zeroing out the new elements . This allows the code to simply iterate over both without keeping track of the minimum size .
static void eqsz(Bitset *a, Bitset *b)
{
    size_t sz;
    size_t i;
    size_t *p;
    if (a->nchunks > b->nchunks)
        sz = a->nchunks;
    else
        sz = b->nchunks;
    if (a->nchunks != sz) {
        p = zalloc(sz * sizeof(size_t));
        for (i = 0; i < a->nchunks; i++)
            p[i] = a->chunks[i];
        free(a->chunks);
        a->chunks = p;
        a->nchunks = sz;
    }
    if (b->nchunks != sz) {
        p = zalloc(sz * sizeof(size_t));
        for (i = 0; i < b->nchunks; i++)
            p[i] = b->chunks[i];
        free(b->chunks);
        b->chunks = p;
        b->nchunks = sz;
    }
}
static void eqsz ( Bitset * a , Bitset * b ) { size_t sz ; size_t i ; size_t * p ; if ( a -> nchunks > b -> nchunks ) sz = a -> nchunks ; else sz = b -> nchunks ; if ( a -> nchunks != sz ) { p = zalloc ( sz * sizeof ( size_t ) ) ; for ( i = 0 ; i < a -> nchunks ; i ++ ) p [ i ] = a -> chunks [ i ] ; free ( a -> chunks ) ; a -> chunks = p ; a -> nchunks = sz ; } if ( b -> nchunks != sz ) { p = zalloc ( sz * sizeof ( size_t ) ) ; for ( i = 0 ; i < b -> nchunks ; i ++ ) p [ i ] = b -> chunks [ i ] ; free ( b -> chunks ) ; b -> chunks = p ; b -> nchunks = sz ; } }
Equalizes the size of a and b by
 growing the smaller to the size of the
 larger, zeroing out the new elements.
Equalizes the size of a and b by growing the smaller to the size of the larger zeroing out the new elements .