[prev] 42 [next]

Exercise 6: Implement Union via Bit Strings

Given the following definitions:

#define NBITS 1024
#define NWORDS (NBITS/32)
typedef unsigned int Word;
typedef Word BitS[NWORDS];

BitS a, b, c;

Implement a function to store the union of a and b in c:

void BitUnion(BitS a, BitS b, BitS c);

Do it once using getBit() et al, and once "optimally".