! @brief Change a bitfield value.

def bfi(value, msb, lsb, field):
    """! @brief Change a bitfield value."""
    mask = bitmask((msb, lsb))
    value &= ~mask
    value |= (field << lsb) & mask
    return value