Skip to content

Commit 0397d22

Browse files
authored
Merge pull request #1409 from ElementsProject/simplicity
Simplicity
2 parents 24b43ea + b475a32 commit 0397d22

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

src/simplicity/eval.c

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -629,19 +629,12 @@ simplicity_err simplicity_analyseBounds( ubounded *cellsBound, ubounded *UWORDBo
629629
, bound[dag[i].child[1]].cost ));
630630
break;
631631
case DISCONNECT:
632-
if (UBOUNDED_MAX <= type_dag[DISCONNECT_W256A(dag, type_dag, i)].bitSize ||
633-
UBOUNDED_MAX <= type_dag[DISCONNECT_BC(dag, type_dag, i)].bitSize) {
634-
/* 'BITSIZE(WORD256 * A)' or 'BITSIZE(B * C)' has exceeded our limits. */
635-
bound[i].extraCellsBound[0] = UBOUNDED_MAX;
636-
bound[i].extraCellsBound[1] = UBOUNDED_MAX;
637-
} else {
638-
bound[i].extraCellsBound[1] = type_dag[DISCONNECT_W256A(dag, type_dag, i)].bitSize;
639-
bound[i].extraCellsBound[0] = bounded_max(
640-
bounded_add( type_dag[DISCONNECT_BC(dag, type_dag, i)].bitSize
641-
, bounded_max( bounded_add(bound[i].extraCellsBound[1], bound[dag[i].child[0]].extraCellsBound[1])
642-
, bounded_max(bound[dag[i].child[0]].extraCellsBound[0], bound[dag[i].child[1]].extraCellsBound[1]))),
643-
bound[dag[i].child[1]].extraCellsBound[0]);
644-
}
632+
bound[i].extraCellsBound[1] = type_dag[DISCONNECT_W256A(dag, type_dag, i)].bitSize;
633+
bound[i].extraCellsBound[0] = bounded_max(
634+
bounded_add( type_dag[DISCONNECT_BC(dag, type_dag, i)].bitSize
635+
, bounded_max( bounded_add(bound[i].extraCellsBound[1], bound[dag[i].child[0]].extraCellsBound[1])
636+
, bounded_max(bound[dag[i].child[0]].extraCellsBound[0], bound[dag[i].child[1]].extraCellsBound[1]))),
637+
bound[dag[i].child[1]].extraCellsBound[0]);
645638
bound[i].extraUWORDBound[1] = (ubounded)ROUND_UWORD(type_dag[DISCONNECT_W256A(dag, type_dag, i)].bitSize);
646639
bound[i].extraUWORDBound[0] = bounded_max(
647640
(ubounded)ROUND_UWORD(type_dag[DISCONNECT_BC(dag, type_dag, i)].bitSize) +
@@ -660,18 +653,12 @@ simplicity_err simplicity_analyseBounds( ubounded *cellsBound, ubounded *UWORDBo
660653
, bounded_add(bound[dag[i].child[0]].cost, bound[dag[i].child[1]].cost))))));
661654
break;
662655
case COMP:
663-
if (UBOUNDED_MAX <= type_dag[COMP_B(dag, type_dag, i)].bitSize) {
664-
/* 'BITSIZE(B)' has exceeded our limits. */
665-
bound[i].extraCellsBound[0] = UBOUNDED_MAX;
666-
bound[i].extraCellsBound[1] = UBOUNDED_MAX;
667-
} else {
668-
bound[i].extraCellsBound[0] = bounded_max( bounded_add( type_dag[COMP_B(dag, type_dag, i)].bitSize
669-
, bounded_max( bound[dag[i].child[0]].extraCellsBound[0]
670-
, bound[dag[i].child[1]].extraCellsBound[1] ))
671-
, bound[dag[i].child[1]].extraCellsBound[0] );
672-
bound[i].extraCellsBound[1] = bounded_add( type_dag[COMP_B(dag, type_dag, i)].bitSize
673-
, bound[dag[i].child[0]].extraCellsBound[1] );
674-
}
656+
bound[i].extraCellsBound[0] = bounded_max( bounded_add( type_dag[COMP_B(dag, type_dag, i)].bitSize
657+
, bounded_max( bound[dag[i].child[0]].extraCellsBound[0]
658+
, bound[dag[i].child[1]].extraCellsBound[1] ))
659+
, bound[dag[i].child[1]].extraCellsBound[0] );
660+
bound[i].extraCellsBound[1] = bounded_add( type_dag[COMP_B(dag, type_dag, i)].bitSize
661+
, bound[dag[i].child[0]].extraCellsBound[1] );
675662
bound[i].extraUWORDBound[0] = bounded_max( (ubounded)ROUND_UWORD(type_dag[COMP_B(dag, type_dag, i)].bitSize) +
676663
bounded_max( bound[dag[i].child[0]].extraUWORDBound[0]
677664
, bound[dag[i].child[1]].extraUWORDBound[1] )

0 commit comments

Comments
 (0)