fn unify(&mut self, base: Int) -> bool {
    while self.ustack.len() > 0 {
      let z1 = self.ustack.pop().unwrap();
      let z2 = self.ustack.pop().unwrap();
      let x1 = self.deref(z1);
      let x2 = self.deref(z2);
      if x1 != x2 {
        let w1 = detag(x1);
        let w2 = detag(x2);
        if is_var(x1) {
          if is_var(x2) && (w2 > w1) {
            self.heap[w2 as usize] = x1;
            if w2 <= base {
              self.trail.push(x2)
            }
          } else {
            self.heap[w1 as usize] = x2;
            if w1 <= base {
              self.trail.push(x1)
            }
          }
        } else if is_var(x2) {
          self.heap[w2 as usize] = x1;
          if w2 <= base {
            self.trail.push(x2)
          }
        } else if R == tag_of(x1) && R == tag_of(x2) {
          if !self.unify_args(w1, w2) {
            return false;
          }
        } else {
          return false;
        }
      }
    }
    true
  }
/**
  * unification algorithm for cells X1 and X2 on ustack that also takes care
  * to trail bindigs below a given heap address "base"
  */
unification algorithm for cells X1 and X2 on ustack that also takes care
to trail bindigs below a given heap address "base"
unification algorithm for cells X1 and X2 on ustack that also takes care to trail bindigs below a given heap address " base "
fn unify(&mut self, base: Int) -> bool {
    while self.ustack.len() > 0 {
      let z1 = self.ustack.pop().unwrap();
      let z2 = self.ustack.pop().unwrap();
      let x1 = self.deref(z1);
      let x2 = self.deref(z2);
      if x1 != x2 {
        let w1 = detag(x1);
        let w2 = detag(x2);
        if is_var(x1) {
          if is_var(x2) && (w2 > w1) {
            self.heap[w2 as usize] = x1;
            if w2 <= base {
              self.trail.push(x2)
            }
          } else {
            self.heap[w1 as usize] = x2;
            if w1 <= base {
              self.trail.push(x1)
            }
          }
        } else if is_var(x2) {
          self.heap[w2 as usize] = x1;
          if w2 <= base {
            self.trail.push(x2)
          }
        } else if R == tag_of(x1) && R == tag_of(x2) {
          if !self.unify_args(w1, w2) {
            return false;
          }
        } else {
          return false;
        }
      }
    }
    true
  }
fn unify ( & mut self , base : Int ) -> bool { while self . ustack . len ( ) > 0 { let z1 = self . ustack . pop ( ) . unwrap ( ) ; let z2 = self . ustack . pop ( ) . unwrap ( ) ; let x1 = self . deref ( z1 ) ; let x2 = self . deref ( z2 ) ; if x1 != x2 { let w1 = detag ( x1 ) ; let w2 = detag ( x2 ) ; if is_var ( x1 ) { if is_var ( x2 ) && ( w2 > w1 ) { self . heap [ w2 as usize ] = x1 ; if w2 <= base { self . trail . push ( x2 ) } } else { self . heap [ w1 as usize ] = x2 ; if w1 <= base { self . trail . push ( x1 ) } } } else if is_var ( x2 ) { self . heap [ w2 as usize ] = x1 ; if w2 <= base { self . trail . push ( x2 ) } } else if R == tag_of ( x1 ) && R == tag_of ( x2 ) { if ! self . unify_args ( w1 , w2 ) { return false ; } } else { return false ; } } } true }
unification algorithm for cells X1 and X2 on ustack that also takes care
 to trail bindigs below a given heap address "base"
unification algorithm for cells X1 and X2 on ustack that also takes care to trail bindigs below a given heap address " base "
&mut self
base
Int
&mut self
base
Int