They are just implementing a generic contiguous bitfield clear.
field_mask was probably constructed as ((1 << width) - 1) instead of as a manifest constant. So you can just do:
ClearBitField(input, width, shift) { return input & ~(((1 << width) - 1) << shift) }
Now you just use that everywhere you would clear a contiguous bitfield which is a pretty common operation when operating on hardware. Now all your bit-twiddling is isolated to a single well-defined generically useful function instead of repeating it a billion times.
We know this is a generically valuable operation since this is basically a C implementation of the ARMv8 bfi (b)it(f)ield (i)nsert instruction with a fixed 0 argument or in assembly:
BFI X{n}, XZR, #shift, #width