vector * new (int n_bits) { vector * p = malloc (sizeof (vector)); if (! p) { croak ("Out of memory"); } p->n_bits = n_bits; /* We use one char to store the bits. The C standard promises that one byte contains at least eight bits. */ p->n_chars = (n_bits + 8 - 1) / 8; p->chars = calloc (p->n_chars, sizeof (unsigned char)); if (! p->chars) { croak ("Out of memory"); } return p; }