fn toggle(mut bit_vector: i32, index: i32) -> i32 {
    if index < 0 {
        return bit_vector;
    }

    let mask = 1 << index;

    if (bit_vector & mask) == 0 {
        bit_vector.bitor_assign(mask);
    } else {
        bit_vector.bitand_assign(!mask);
    }

    bit_vector
}
/// Toggle the ith bit in the integer
/// todo: check why the bit_vector grow after the 3rd iteration
Toggle the ith bit in the integer
todo: check why the bit_vector grow after the 3rd iteration
Toggle the ith bit in the integer todo : check why the bit_vector grow after the 3rd iteration
fn toggle(mut bit_vector: i32, index: i32) -> i32 {
    if index < 0 {
        return bit_vector;
    }
    let mask = 1 << index;
    if (bit_vector & mask) == 0 {
        bit_vector.bitor_assign(mask);
    } else {
        bit_vector.bitand_assign(!mask);
    }
    bit_vector
}
fn toggle ( mut bit_vector : i32 , index : i32 ) -> i32 { if index < 0 { return bit_vector ; } let mask = 1 << index ; if ( bit_vector & mask ) == 0 { bit_vector . bitor_assign ( mask ) ; } else { bit_vector . bitand_assign ( ! mask ) ; } bit_vector }
Toggle the ith bit in the integer
todo: check why the bit_vector grow after the 3rd iteration
Toggle the ith bit in the integer todo : check why the bit_vector grow after the 3rd iteration
bit_vector
i32
index
i32
bit_vector
i32
index
i32