47 static int M[7][3] = {{0},{0},{0},{0},{0},{0},{0}};
50 int nLeaves0, nLeaves1, Limit;
51 int i, k, Count, nNodes;
59 if ( nLeaves0 == Limit && nLeaves1 == Limit )
61 for ( i = 0; i < nLeaves0; i++ )
65 for ( i = 0; i < nLeaves0; i++ )
71 if ( nLeaves0 == Limit )
73 for ( i = 0; i < nLeaves1; i++ )
75 for ( k = nLeaves0 - 1; k >= 0; k-- )
82 for ( i = 0; i < nLeaves0; i++ )
89 for ( i = 0; i < nLeaves1; i++ )
91 for ( k = nLeaves0 - 1; k >= 0; k-- )
99 pRow[0] = pCut1->
pLeaves[i], pRow[1] = 0;
100 else if ( pRow[1] == 0 )
101 pRow[1] = pCut1->
pLeaves[i], pRow[2] = 0;
102 else if ( pRow[2] == 0 )
106 if ( ++nNodes > Limit )
108 for ( i = 0; i <= nLeaves0; i++ )
119 pRow[0] = pCut1->
pLeaves[i], pRow[1] = 0;
120 else if ( pRow[1] == 0 )
121 pRow[1] = pCut1->
pLeaves[i], pRow[2] = 0;
122 else if ( pRow[2] == 0 )
126 if ( ++nNodes > Limit )
128 for ( i = 0; i <= nLeaves0; i++ )
137 for ( Count = 0, i = 0; i <= nLeaves0; i++ )
144 pRes->
pLeaves[Count++] = pRow[0];
147 pRes->
pLeaves[Count++] = pRow[1];
149 pRes->
pLeaves[Count++] = pRow[2];
154 assert( Count == nNodes );
174 int Limit, nLeaves0, nLeaves1;
185 if ( nLeaves0 == Limit && nLeaves1 == Limit )
187 for ( i = 0; i < nLeaves0; i++ )
191 for ( i = 0; i < nLeaves0; i++ )
197 if ( nLeaves0 == Limit )
199 for ( i = 0; i < nLeaves1; i++ )
201 for ( k = nLeaves0 - 1; k >= 0; k-- )
208 for ( i = 0; i < nLeaves0; i++ )
221 for ( c = 0; c < Limit; c++ )
231 pLeaves[c] = pCut0->
pLeaves[i++];
242 pLeaves[c] = pCut1->
pLeaves[k++];
247 pLeaves[c] = pCut0->
pLeaves[i++];
252 pLeaves[c] = pCut1->
pLeaves[k++];
255 pLeaves[c] = pCut0->
pLeaves[i++];
258 if ( i < nLeaves0 || k < nLeaves1 )
281 int Limit, nLeaves0, nLeaves1;
295 if ( nLeaves0 == Limit )
297 if ( nLeaves1 == Limit )
299 for ( i = 0; i < nLeaves0; i++ )
301 pLeaves[i] = pCut0->
pLeaves[i];
302 if ( pLeaves[i] != pCut1->
pLeaves[i] )
308 for ( i = k = 0; i < nLeaves0; i++ )
310 pLeaves[i] = pCut0->
pLeaves[i];
311 if ( k == (
int)nLeaves1 )
313 if ( pLeaves[i] < pCut1->
pLeaves[k] )
315 if ( pLeaves[i] == pCut1->
pLeaves[k++] )
329 for ( c = 0; c < Limit; c++ )
339 pLeaves[c] = pCut0->
pLeaves[i++];
350 pLeaves[c] = pCut1->
pLeaves[k++];
355 pLeaves[c] = pCut0->
pLeaves[i++];
360 pLeaves[c] = pCut1->
pLeaves[k++];
363 pLeaves[c] = pCut0->
pLeaves[i++];
366 if ( i < nLeaves0 || k < nLeaves1 )
388 int i, k, min, NodeTemp, Limit,
nTotal;
399 if ( pCut0->
nLeaves == (
unsigned)Limit )
401 if ( pCut1->
nLeaves == (
unsigned)Limit )
403 for ( i = 0; i < (int)pCut0->
nLeaves; i++ )
405 pLeaves[i] = pCut0->
pLeaves[i];
406 if ( pLeaves[i] != pCut1->
pLeaves[i] )
412 for ( i = k = 0; i < (int)pCut0->
nLeaves; i++ )
414 pLeaves[i] = pCut0->
pLeaves[i];
415 if ( k == (
int)pCut1->
nLeaves )
417 if ( pLeaves[i] < pCut1->
pLeaves[k] )
419 if ( pLeaves[i] == pCut1->
pLeaves[k++] )
433 for ( i = 0; i < (int)pCut1->
nLeaves; i++ )
436 for ( k = 0; k < (int)pCut0->
nLeaves; k++ )
442 if ( nTotal == Limit )
444 pLeaves[nTotal++] = pCut1->
pLeaves[i];
449 for ( k = 0; k < (int)pCut0->
nLeaves; k++ )
450 pLeaves[k] = pCut0->
pLeaves[k];
453 for ( i = 0; i < nTotal - 1; i++ )
456 for ( k = i+1; k <
nTotal; k++ )
457 if ( pLeaves[k] < pLeaves[min] )
459 NodeTemp = pLeaves[i];
460 pLeaves[i] = pLeaves[min];
461 pLeaves[min] = NodeTemp;
481 static int M[7][3] = {{0},{0},{0},{0},{0},{0},{0}};
484 unsigned uSign0, uSign1;
485 int i, k, nNodes, Count;
493 for ( i = 0; i < (int)pCut0->
nLeaves; i++ )
497 for ( i = 0; i < (int)pCut0->
nLeaves; i++ )
507 for ( i = 0; i < (int)pCut1->
nLeaves; i++ )
509 for ( k = pCut0->
nLeaves - 1; k >= 0; k-- )
520 for ( i = 0; i < (int)pCut1->
nLeaves; i++ )
522 for ( k = pCut0->
nLeaves - 1; k >= 0; k-- )
534 for ( i = 0; i < (int)pCut0->
nLeaves; i++ )
541 for ( i = 0; i < (int)pCut1->
nLeaves; i++ )
543 for ( k = pCut0->
nLeaves - 1; k >= 0; k-- )
551 pRow[0] = pCut1->
pLeaves[i], pRow[1] = 0;
552 else if ( pRow[1] == 0 )
553 pRow[1] = pCut1->
pLeaves[i], pRow[2] = 0;
554 else if ( pRow[2] == 0 )
558 if ( ++nNodes > (
int)Limit )
560 for ( i = 0; i <= (int)pCut0->
nLeaves; i++ )
571 pRow[0] = pCut1->
pLeaves[i], pRow[1] = 0;
572 else if ( pRow[1] == 0 )
573 pRow[1] = pCut1->
pLeaves[i], pRow[2] = 0;
574 else if ( pRow[2] == 0 )
578 if ( ++nNodes > (
int)Limit )
580 for ( i = 0; i <= (int)pCut0->
nLeaves; i++ )
591 for ( Count = 0, i = 0; i <= (int)pCut0->
nLeaves; i++ )
598 pRes->
pLeaves[Count++] = pRow[0];
601 pRes->
pLeaves[Count++] = pRow[1];
603 pRes->
pLeaves[Count++] = pRow[2];
608 assert( Count == nNodes );
624 for ( Count = 0, i = 0; i <= (int)pCut0->
nLeaves; i++ )
628 uSign0 |= (1 << Count);
634 uSign1 |= (1 << Count);
635 pRes->
pLeaves[Count++] = pRow[0];
638 uSign1 |= (1 << Count);
639 pRes->
pLeaves[Count++] = pRow[1];
642 uSign1 |= (1 << Count);
643 pRes->
pLeaves[Count++] = pRow[2];
649 assert( Count == nNodes );
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_CutAlloc(Cut_Man_t *p)
DECLARATIONS ///.
word M(word f1, word f2, int n)
Cut_Cut_t * Cut_CutMergeTwo3(Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
Cut_Cut_t * Cut_CutMergeTwo(Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
Cut_Cut_t * Cut_CutMergeTwo4(Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_START
Cut_Cut_t * Cut_CutMergeTwo5(Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_CutMergeTwo2(Cut_Man_t *p, Cut_Cut_t *pCut0, Cut_Cut_t *pCut1)
DECLARATIONS ///.
int nTotal
DECLARATIONS ///.