Unanswered
Debugging Loop Error in FunC: Manual Iteration vs While Loop in Bit Manipulation Functions
here is my FunC code:
forall X -> int is_null (X x) asm "ISNULL";
forall X -> (tuple, ()) push_back (tuple tail, X head) asm "CONS";
forall X -> (tuple, (X)) pop_back (tuple t) asm "UNCONS";
forall X -> X car(tuple list) asm "CAR";
() recv_internal() {
;;;;;;;
}
(tuple) write_bit(tuple lisp, int bit) {
if (lisp.is_null()) | (lisp.car().builder_bits() == 1023) {
lisp~push_back(begin_cell());
}
builder b = lisp~pop_back();
b~store_int(bit, 1);
lisp~push_back(b);
return lisp;
}
;; testable
(cell) find_and_replace(int flag, int value, cell linked_list) method_id {
tuple lisp = null();
int i = 0;
;; while i < 5 {
;; lisp = write_bit(lisp, 1);
;;
;; i += 1;
;; }
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
return begin_cell().end_cell();
}
Would like to know why I got the error code here:
"Error: Unable to execute get method. Got exit_code: 7"
But if I comment this loop and iterate manually L147-151 - no errors are thrown
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
lisp = write_bit(lisp, 1);
This question was imported from Telegram Chat: https://t.me/tondev_eng/32818
12K Views
0
Answers
one year ago
one year ago
Tags