def pack_bitflags(*values):
    """
    Pack separate booleans back into a bit field.
    """
    result = 0
    for i, val in enumerate(values):
        if val:
            result |= 1 << i
    return result
