public static void swap(IntegerStack one,int oneLim,
                          IntegerStack other,int otherLim) {
    // this is used for swapping labels in logical expressions compilation
    // usually there are not so many labels to swap... and the element
    // by element copy should not incur significant peformance penalty
    // ordering of elements between limits is not important
    
    IntegerStack temp=null;
    if (one.size()>oneLim)
      temp=new IntegerStack();

    //    System.out.println("vgv  one.size()= "+one.size()+" ( "+oneLim+" )"+
    //                   "  other.size()= "+other.size()+" ( "+otherLim+" )");

    while (one.size()>oneLim)
      temp.push(one.pop());
    while (other.size()>otherLim)
      one.push(other.pop());
    while ((temp!=null) && (temp.size()>0))
      other.push(temp.pop());

// ----- faster version of the same
//      int copyFromOne=one.count-oneLim;
//      int copyFromOther=other.count-otherLim;
//      boolean cf_one=copyFromOne>0;
//      boolean cf_other=copyFromOther>0;
//      if ((cf_one) || (cf_other)) {
//        int nSizeOne=oneLim+copyFromOther;
//        int nSizeOther=otherLim+copyFromOne;
//        // ensure capacities
//        if (nSizeOne>one.data.length) one.incCap(nSizeOne);
//        if (nSizeOther>other.data.length) other.incCap(nSizeOther);
//        int[] temp=null;
//        if (cf_one) {
//          temp=new int[copyFromOne];
//          System.arraycopy(one.data,oneLim,temp,0,copyFromOne);
//        };
//        if (cf_other)
//         System.arraycopy(other.data,otherLim,one.data,oneLim,copyFromOther);
//        if (cf_one)
//          System.arraycopy(temp,0,other.data,otherLim,copyFromOne);
//        one.count=nSizeOne;
//        other.count=nSizeOther;
//      };
// ----- end of faster version of the same

  };