You have to use CompareExchange primitive. What exactly you need to write, depends on the compiler and the platform. However, in theory, it looks like the following.
Assume CompareExchange returns oldvalue and atomically changes value only if oldvalue is not changed.
do { oldvalue = bitset; newvalue = oldvalue|bitvalue; } while ( oldvalue != CompareExchange(&bitset,newvalue,oldvalue) );
Since CompareExchange is atomic, it will set bits atomically. But you can set bits atomically only in maximum one processor word sized bitset.