fn pivot(&self, mask: isize) -> Vec<(u8, isize)> {
        match self {
            ComplexAddressing(_functions) => {
                let mut matrix = Vec::new();

                let mut i = 1;
                let mut hashspace = 0;
                while i != 0 {
                    if i & mask != 0 {
                        let h = self.hash(i as usize).unwrap();

                        hashspace |= h;
                        matrix.push((h, i));
                    }
                    i <<= 1;
                }

                let mut i = 0; // current line in the matrix.
                let mut bit = 1;
                while bit != 0 {
                    if bit & hashspace != 0 {
                        let mut found_pivot = false;
                        for j in i..matrix.len() {
                            if matrix[j].0 & bit != 0 {
                                found_pivot = true;
                                if j != i {
                                    let mi = matrix[i];
                                    let mj = matrix[j];
                                    matrix[i] = mj;
                                    matrix[j] = mi;
                                }
                                break;
                            }
                        }
                        if found_pivot {
                            for j in 0..matrix.len() {
                                if j != i && bit & matrix[j].0 != 0 {
                                    matrix[j].0 ^= matrix[i].0;
                                    matrix[j].1 ^= matrix[i].1;
                                }
                            }
                            i += 1;
                        }
                    }
                    bit <<= 1;
                }
                while i < matrix.len() {
                    if matrix[i].0 != 0 {
                        panic!("Something went wrong with the pivot algorithm")
                    }
                    i += 1;
                }

                matrix
            }
            _ => panic!("Should not be called"),
        }
    }
// Only works for Complex Addressing rn
// May work in the future for simple.
Only works for Complex Addressing rn
May work in the future for simple.
Only works for Complex Addressing rn May work in the future for simple .
fn pivot(&self, mask: isize) -> Vec<(u8, isize)> {
        match self {
            ComplexAddressing(_functions) => {
                let mut matrix = Vec::new();
                let mut i = 1;
                let mut hashspace = 0;
                while i != 0 {
                    if i & mask != 0 {
                        let h = self.hash(i as usize).unwrap();
                        hashspace |= h;
                        matrix.push((h, i));
                    }
                    i <<= 1;
                }
                let mut i = 0; // current line in the matrix.
                let mut bit = 1;
                while bit != 0 {
                    if bit & hashspace != 0 {
                        let mut found_pivot = false;
                        for j in i..matrix.len() {
                            if matrix[j].0 & bit != 0 {
                                found_pivot = true;
                                if j != i {
                                    let mi = matrix[i];
                                    let mj = matrix[j];
                                    matrix[i] = mj;
                                    matrix[j] = mi;
                                }
                                break;
                            }
                        }
                        if found_pivot {
                            for j in 0..matrix.len() {
                                if j != i && bit & matrix[j].0 != 0 {
                                    matrix[j].0 ^= matrix[i].0;
                                    matrix[j].1 ^= matrix[i].1;
                                }
                            }
                            i += 1;
                        }
                    }
                    bit <<= 1;
                }
                while i < matrix.len() {
                    if matrix[i].0 != 0 {
                        panic!("Something went wrong with the pivot algorithm")
                    }
                    i += 1;
                }
                matrix
            }
            _ => panic!("Should not be called"),
        }
    }
fn pivot ( & self , mask : isize ) -> Vec < ( u8 , isize ) > { match self { ComplexAddressing ( _functions ) => { let mut matrix = Vec :: new ( ) ; let mut i = 1 ; let mut hashspace = 0 ; while i != 0 { if i & mask != 0 { let h = self . hash ( i as usize ) . unwrap ( ) ; hashspace |= h ; matrix . push ( ( h , i ) ) ; } i <<= 1 ; } let mut i = 0 ; // current line in the matrix. let mut bit = 1 ; while bit != 0 { if bit & hashspace != 0 { let mut found_pivot = false ; for j in i .. matrix . len ( ) { if matrix [ j ] . 0 & bit != 0 { found_pivot = true ; if j != i { let mi = matrix [ i ] ; let mj = matrix [ j ] ; matrix [ i ] = mj ; matrix [ j ] = mi ; } break ; } } if found_pivot { for j in 0 .. matrix . len ( ) { if j != i && bit & matrix [ j ] . 0 != 0 { matrix [ j ] . 0 ^= matrix [ i ] . 0 ; matrix [ j ] . 1 ^= matrix [ i ] . 1 ; } } i += 1 ; } } bit <<= 1 ; } while i < matrix . len ( ) { if matrix [ i ] . 0 != 0 { panic ! ( " " ) } i += 1 ; } matrix } _ => panic ! ( " " ) , } }
Only works for Complex Addressing rn
May work in the future for simple.
Only works for Complex Addressing rn May work in the future for simple .
&self
mask
isize