bits... replace bits in unsigned long

Lets say I have an unsigned long and an unsigned int and I want to replace a section of the bits in the long with the bits of the int.

I can do this one bit at a time easily.. but is there anyway to replace multiple bits at once when we have different data types?

i am not sure, but can't you just cast the int as long?
Something like:

tochange_long |= ( (long)replace_int & mask ) << offset;
tochange_long &= !( (long)replace_int & mask ) << offset;

where mask is a.....mask.... with ones on the places of replacement
and offset the ....offset... where to start with replacing?

(did not think proper of the logic. Maybe ones or zeros get shifted in. Or if some more brackets are needed. Just meant as an idea... Not the full solution!)