Bit fields are a specific C language feature, allowing to treat bit slices as a unit whose length doesn’t need to correspond to one of the integer types. See for example https://docs.microsoft.com/en-us/cpp/c-language/c-bit-fields....
void bar(struct y *s, unsigned int foo) {
s->c = (s->c & 0xf0) | foo;
}Not always. Switch your example to AARCH64 and check out the BFI instruction.