From a2a011f0ca3c8e0cd748ad2213f2a0cb9b196ebd Mon Sep 17 00:00:00 2001 From: Anton Trunov Date: Wed, 30 Oct 2024 17:41:32 +0400 Subject: [PATCH] refactor: codegen for __tact_dict operations (#993) --- .../writeSerialization.spec.ts.snap | 6630 ++++++++--------- src/generator/writers/writeStdlib.ts | 1219 +-- 2 files changed, 3614 insertions(+), 4235 deletions(-) diff --git a/src/generator/writers/__snapshots__/writeSerialization.spec.ts.snap b/src/generator/writers/__snapshots__/writeSerialization.spec.ts.snap index b7815dc4f..40dd6eb73 100644 --- a/src/generator/writers/__snapshots__/writeSerialization.spec.ts.snap +++ b/src/generator/writers/__snapshots__/writeSerialization.spec.ts.snap @@ -642,12 +642,7 @@ return __tact_base64_encode(user_friendly_address_with_checksum);", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", + "code": "return equal_slices_bits(a, b);", "kind": "generic", }, "comment": null, @@ -656,17 +651,12 @@ return __tact_base64_encode(user_friendly_address_with_checksum);", "flags": Set { "inline", }, - "name": "__tact_dict_set_int_int", - "signature": "(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl)", + "name": "__tact_slice_eq_bits", + "signature": "int __tact_slice_eq_bits(slice a, slice b)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", + "code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));", "kind": "generic", }, "comment": null, @@ -675,17 +665,14 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_int", - "signature": "int __tact_dict_get_int_int(cell d, int kl, int k, int vl)", + "name": "__tact_slice_eq_bits_nullable_one", + "signature": "int __tact_slice_eq_bits_nullable_one(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -694,36 +681,41 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_int", - "signature": "(int, int, int) __tact_dict_min_int_int(cell d, int kl, int vl)", + "name": "__tact_slice_eq_bits_nullable", + "signature": "int __tact_slice_eq_bits_nullable(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "(slice key, slice value, int flag) = __tact_dict_min(a, kl); +while (flag) { + (slice value_b, int flag_b) = b~__tact_dict_delete_get(kl, key); + ifnot (flag_b) { + return 0; + } + ifnot (value.slice_hash() == value_b.slice_hash()) { + return 0; + } + (key, value, flag) = __tact_dict_next(a, kl, key); +} +return null?(b);", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + "__tact_dict_delete_get", + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_dict_next_int_int", - "signature": "(int, int, int) __tact_dict_next_int_int(cell d, int kl, int pivot, int vl)", + "name": "__tact_dict_eq", + "signature": "int __tact_dict_eq(cell a, cell b, int kl)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", + "code": "return (null?(a)) ? (false) : (a == b);", "kind": "generic", }, "comment": null, @@ -732,17 +724,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_int_uint", - "signature": "(cell, ()) __tact_dict_set_int_uint(cell d, int kl, int k, int v, int vl)", + "name": "__tact_int_eq_nullable_one", + "signature": "int __tact_int_eq_nullable_one(int a, int b)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", + "code": "return (null?(a)) ? (true) : (a != b);", "kind": "generic", }, "comment": null, @@ -751,17 +738,14 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_uint", - "signature": "int __tact_dict_get_int_uint(cell d, int kl, int k, int vl)", + "name": "__tact_int_neq_nullable_one", + "signature": "int __tact_int_neq_nullable_one(int a, int b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a == b ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -770,17 +754,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_uint", - "signature": "(int, int, int) __tact_dict_min_int_uint(cell d, int kl, int vl)", + "name": "__tact_int_eq_nullable", + "signature": "int __tact_int_eq_nullable(int a, int b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a != b ) : ( true ) );", "kind": "generic", }, "comment": null, @@ -789,17 +770,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_int_uint", - "signature": "(int, int, int) __tact_dict_next_int_uint(cell d, int kl, int pivot, int vl)", + "name": "__tact_int_neq_nullable", + "signature": "int __tact_int_neq_nullable(int a, int b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", + "code": "return (a.cell_hash() == b.cell_hash());", "kind": "generic", }, "comment": null, @@ -808,17 +784,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_uint_int", - "signature": "(cell, ()) __tact_dict_set_uint_int(cell d, int kl, int k, int v, int vl)", + "name": "__tact_cell_eq", + "signature": "int __tact_cell_eq(cell a, cell b)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", + "code": "return (a.cell_hash() != b.cell_hash());", "kind": "generic", }, "comment": null, @@ -827,17 +798,12 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_int", - "signature": "int __tact_dict_get_uint_int(cell d, int kl, int k, int vl)", + "name": "__tact_cell_neq", + "signature": "int __tact_cell_neq(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (null?(a)) ? (false) : (a.cell_hash() == b.cell_hash());", "kind": "generic", }, "comment": null, @@ -846,17 +812,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_uint_int", - "signature": "(int, int, int) __tact_dict_min_uint_int(cell d, int kl, int vl)", + "name": "__tact_cell_eq_nullable_one", + "signature": "int __tact_cell_eq_nullable_one(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (null?(a)) ? (true) : (a.cell_hash() != b.cell_hash());", "kind": "generic", }, "comment": null, @@ -865,17 +826,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_uint_int", - "signature": "(int, int, int) __tact_dict_next_uint_int(cell d, int kl, int pivot, int vl)", + "name": "__tact_cell_neq_nullable_one", + "signature": "int __tact_cell_neq_nullable_one(cell a, cell b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() == b.cell_hash() ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -884,17 +842,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_uint_uint", - "signature": "(cell, ()) __tact_dict_set_uint_uint(cell d, int kl, int k, int v, int vl)", + "name": "__tact_cell_eq_nullable", + "signature": "int __tact_cell_eq_nullable(cell a, cell b)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() != b.cell_hash() ) : ( true ) );", "kind": "generic", }, "comment": null, @@ -903,17 +858,12 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_uint", - "signature": "int __tact_dict_get_uint_uint(cell d, int kl, int k, int vl)", + "name": "__tact_cell_neq_nullable", + "signature": "int __tact_cell_neq_nullable(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (a.slice_hash() == b.slice_hash());", "kind": "generic", }, "comment": null, @@ -922,17 +872,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_uint_uint", - "signature": "(int, int, int) __tact_dict_min_uint_uint(cell d, int kl, int vl)", + "name": "__tact_slice_eq", + "signature": "int __tact_slice_eq(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (a.slice_hash() != b.slice_hash());", "kind": "generic", }, "comment": null, @@ -941,17 +886,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_uint_uint", - "signature": "(int, int, int) __tact_dict_next_uint_uint(cell d, int kl, int pivot, int vl)", + "name": "__tact_slice_neq", + "signature": "int __tact_slice_neq(slice a, slice b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_ref(d, kl, k, v), ()); -}", + "code": "return (null?(a)) ? (false) : (a.slice_hash() == b.slice_hash());", "kind": "generic", }, "comment": null, @@ -960,17 +900,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_int_cell", - "signature": "(cell, ()) __tact_dict_set_int_cell(cell d, int kl, int k, cell v)", + "name": "__tact_slice_eq_nullable_one", + "signature": "int __tact_slice_eq_nullable_one(slice a, slice b)", }, { "code": { - "code": "var (r, ok) = idict_get_ref?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", + "code": "return (null?(a)) ? (true) : (a.slice_hash() != b.slice_hash());", "kind": "generic", }, "comment": null, @@ -979,17 +914,14 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_cell", - "signature": "cell __tact_dict_get_int_cell(cell d, int kl, int k)", + "name": "__tact_slice_neq_nullable_one", + "signature": "int __tact_slice_neq_nullable_one(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min_ref?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() == b.slice_hash() ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -998,17 +930,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_cell", - "signature": "(int, cell, int) __tact_dict_min_int_cell(cell d, int kl)", + "name": "__tact_slice_eq_nullable", + "signature": "int __tact_slice_eq_nullable(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() != b.slice_hash() ) : ( true ) );", "kind": "generic", }, "comment": null, @@ -1017,17 +946,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_int_cell", - "signature": "(int, cell, int) __tact_dict_next_int_cell(cell d, int kl, int pivot)", + "name": "__tact_slice_neq_nullable", + "signature": "int __tact_slice_neq_nullable(slice a, slice b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_ref(d, kl, k, v), ()); -}", + "code": "return udict_set_ref(dict, 16, id, code);", "kind": "generic", }, "comment": null, @@ -1036,17 +960,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_uint_cell", - "signature": "(cell, ()) __tact_dict_set_uint_cell(cell d, int kl, int k, cell v)", + "name": "__tact_dict_set_code", + "signature": "cell __tact_dict_set_code(cell dict, int id, cell code)", }, { "code": { - "code": "var (r, ok) = udict_get_ref?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", + "code": "var (data, ok) = udict_get_ref?(dict, 16, id); +throw_unless(135, ok); +return data;", "kind": "generic", }, "comment": null, @@ -1055,36 +976,25 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_cell", - "signature": "cell __tact_dict_get_uint_cell(cell d, int kl, int k)", + "name": "__tact_dict_get_code", + "signature": "cell __tact_dict_get_code(cell dict, int id)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min_ref?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "NIL", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_uint_cell", - "signature": "(int, cell, int) __tact_dict_min_uint_cell(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_create_0", + "signature": "tuple __tact_tuple_create_0()", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", + "code": "return ();", "kind": "generic", }, "comment": null, @@ -1093,496 +1003,402 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_uint_cell", - "signature": "(int, cell, int) __tact_dict_next_uint_cell(cell d, int kl, int pivot)", + "name": "__tact_tuple_destroy_0", + "signature": "() __tact_tuple_destroy_0()", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "1 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_int_slice", - "signature": "(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v)", + "flags": Set {}, + "name": "__tact_tuple_create_1", + "signature": "forall X0 -> tuple __tact_tuple_create_1((X0) v)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "1 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_int_slice", - "signature": "slice __tact_dict_get_int_slice(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_destroy_1", + "signature": "forall X0 -> (X0) __tact_tuple_destroy_1(tuple v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "2 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_int_slice", - "signature": "(int, slice, int) __tact_dict_min_int_slice(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_create_2", + "signature": "forall X0, X1 -> tuple __tact_tuple_create_2((X0, X1) v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "2 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_int_slice", - "signature": "(int, slice, int) __tact_dict_next_int_slice(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_destroy_2", + "signature": "forall X0, X1 -> (X0, X1) __tact_tuple_destroy_2(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "3 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_uint_slice", - "signature": "(cell, ()) __tact_dict_set_uint_slice(cell d, int kl, int k, slice v)", + "flags": Set {}, + "name": "__tact_tuple_create_3", + "signature": "forall X0, X1, X2 -> tuple __tact_tuple_create_3((X0, X1, X2) v)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "3 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_uint_slice", - "signature": "slice __tact_dict_get_uint_slice(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_destroy_3", + "signature": "forall X0, X1, X2 -> (X0, X1, X2) __tact_tuple_destroy_3(tuple v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "4 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_uint_slice", - "signature": "(int, slice, int) __tact_dict_min_uint_slice(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_create_4", + "signature": "forall X0, X1, X2, X3 -> tuple __tact_tuple_create_4((X0, X1, X2, X3) v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "4 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_uint_slice", - "signature": "(int, slice, int) __tact_dict_next_uint_slice(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_destroy_4", + "signature": "forall X0, X1, X2, X3 -> (X0, X1, X2, X3) __tact_tuple_destroy_4(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", - "kind": "generic", + "code": "5 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_int", - "signature": "(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_5", + "signature": "forall X0, X1, X2, X3, X4 -> tuple __tact_tuple_create_5((X0, X1, X2, X3, X4) v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", - "kind": "generic", + "code": "5 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_int", - "signature": "int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_5", + "signature": "forall X0, X1, X2, X3, X4 -> (X0, X1, X2, X3, X4) __tact_tuple_destroy_5(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "6 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_int", - "signature": "(slice, int, int) __tact_dict_min_slice_int(cell d, int kl, int vl)", - }, - { + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_6", + "signature": "forall X0, X1, X2, X3, X4, X5 -> tuple __tact_tuple_create_6((X0, X1, X2, X3, X4, X5) v)", + }, + { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "6 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_int", - "signature": "(slice, int, int) __tact_dict_next_slice_int(cell d, int kl, slice pivot, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_6", + "signature": "forall X0, X1, X2, X3, X4, X5 -> (X0, X1, X2, X3, X4, X5) __tact_tuple_destroy_6(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", - "kind": "generic", + "code": "7 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_uint", - "signature": "(cell, ()) __tact_dict_set_slice_uint(cell d, int kl, slice k, int v, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_7", + "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> tuple __tact_tuple_create_7((X0, X1, X2, X3, X4, X5, X6) v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", - "kind": "generic", + "code": "7 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_uint", - "signature": "int __tact_dict_get_slice_uint(cell d, int kl, slice k, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_7", + "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> (X0, X1, X2, X3, X4, X5, X6) __tact_tuple_destroy_7(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "8 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_uint", - "signature": "(slice, int, int) __tact_dict_min_slice_uint(cell d, int kl, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_8", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> tuple __tact_tuple_create_8((X0, X1, X2, X3, X4, X5, X6, X7) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "8 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_uint", - "signature": "(slice, int, int) __tact_dict_next_slice_uint(cell d, int kl, slice pivot, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_8", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> (X0, X1, X2, X3, X4, X5, X6, X7) __tact_tuple_destroy_8(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return __tact_dict_set_ref(d, kl, k, v); -}", - "kind": "generic", + "code": "9 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - "__tact_dict_set_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_cell", - "signature": "(cell, ()) __tact_dict_set_slice_cell(cell d, int kl, slice k, cell v)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_9", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> tuple __tact_tuple_create_9((X0, X1, X2, X3, X4, X5, X6, X7, X8) v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get_ref(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "9 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_cell", - "signature": "cell __tact_dict_get_slice_cell(cell d, int kl, slice k)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_9", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8) __tact_tuple_destroy_9(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min_ref(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "10 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_cell", - "signature": "(slice, cell, int) __tact_dict_min_slice_cell(cell d, int kl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_10", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> tuple __tact_tuple_create_10((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "10 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_cell", - "signature": "(slice, cell, int) __tact_dict_next_slice_cell(cell d, int kl, slice pivot)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_10", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __tact_tuple_destroy_10(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ()); -}", - "kind": "generic", + "code": "11 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_slice", - "signature": "(cell, ()) __tact_dict_set_slice_slice(cell d, int kl, slice k, slice v)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_11", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> tuple __tact_tuple_create_11((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "11 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_11", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __tact_tuple_destroy_11(tuple v)", + }, + { + "code": { + "code": "12 TUPLE", + "kind": "asm", + "shuffle": "", }, - "flags": Set { - "inline", + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_12", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> tuple __tact_tuple_create_12((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) v)", + }, + { + "code": { + "code": "12 UNTUPLE", + "kind": "asm", + "shuffle": "", }, - "name": "__tact_dict_get_slice_slice", - "signature": "slice __tact_dict_get_slice_slice(cell d, int kl, slice k)", + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_12", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __tact_tuple_destroy_12(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "13 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_13", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> tuple __tact_tuple_create_13((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) v)", + }, + { + "code": { + "code": "13 UNTUPLE", + "kind": "asm", + "shuffle": "", }, - "flags": Set { - "inline", + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_13", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __tact_tuple_destroy_13(tuple v)", + }, + { + "code": { + "code": "14 TUPLE", + "kind": "asm", + "shuffle": "", }, - "name": "__tact_dict_min_slice_slice", - "signature": "(slice, slice, int) __tact_dict_min_slice_slice(cell d, int kl)", + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_14", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> tuple __tact_tuple_create_14((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) v)", }, { "code": { - "code": "return __tact_dict_next(d, kl, pivot);", - "kind": "generic", + "code": "14 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_14", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __tact_tuple_destroy_14(tuple v)", + }, + { + "code": { + "code": "15 TUPLE", + "kind": "asm", + "shuffle": "", }, - "flags": Set { - "inline", + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_15", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> tuple __tact_tuple_create_15((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) v)", + }, + { + "code": { + "code": "15 UNTUPLE", + "kind": "asm", + "shuffle": "", }, - "name": "__tact_dict_next_slice_slice", - "signature": "(slice, slice, int) __tact_dict_next_slice_slice(cell d, int kl, slice pivot)", + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_15", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __tact_tuple_destroy_15(tuple v)", }, { "code": { - "code": "return equal_slices_bits(a, b);", + "code": "return tpush(tpush(empty_tuple(), b), null());", "kind": "generic", }, "comment": null, @@ -1591,71 +1407,66 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_slice_eq_bits", - "signature": "int __tact_slice_eq_bits(slice a, slice b)", + "name": "__tact_string_builder_start", + "signature": "tuple __tact_string_builder_start(builder b)", }, { "code": { - "code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));", + "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 32));", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_start", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_bits_nullable_one", - "signature": "int __tact_slice_eq_bits_nullable_one(slice a, slice b)", + "name": "__tact_string_builder_start_comment", + "signature": "tuple __tact_string_builder_start_comment()", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );", + "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 8));", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_start", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_bits_nullable", - "signature": "int __tact_slice_eq_bits_nullable(slice a, slice b)", + "name": "__tact_string_builder_start_tail_string", + "signature": "tuple __tact_string_builder_start_tail_string()", }, { "code": { - "code": "(slice key, slice value, int flag) = __tact_dict_min(a, kl); -while (flag) { - (slice value_b, int flag_b) = b~__tact_dict_delete_get(kl, key); - ifnot (flag_b) { - return 0; - } - ifnot (value.slice_hash() == value_b.slice_hash()) { - return 0; - } - (key, value, flag) = __tact_dict_next(a, kl, key); -} -return null?(b);", + "code": "return __tact_string_builder_start(begin_cell());", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set { - "__tact_dict_min", - "__tact_dict_delete_get", - "__tact_dict_next", + "__tact_string_builder_start", }, "flags": Set { "inline", }, - "name": "__tact_dict_eq", - "signature": "int __tact_dict_eq(cell a, cell b, int kl)", + "name": "__tact_string_builder_start_string", + "signature": "tuple __tact_string_builder_start_string()", }, { "code": { - "code": "return (null?(a)) ? (false) : (a == b);", + "code": "(builder b, tuple tail) = uncons(builders); +cell c = b.end_cell(); +while(~ null?(tail)) { + (b, tail) = uncons(tail); + c = b.store_ref(c).end_cell(); +} +return c;", "kind": "generic", }, "comment": null, @@ -1664,86 +1475,203 @@ return null?(b);", "flags": Set { "inline", }, - "name": "__tact_int_eq_nullable_one", - "signature": "int __tact_int_eq_nullable_one(int a, int b)", + "name": "__tact_string_builder_end", + "signature": "cell __tact_string_builder_end(tuple builders)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a != b);", + "code": "return __tact_string_builder_end(builders).begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_end", + }, "flags": Set { "inline", }, - "name": "__tact_int_neq_nullable_one", - "signature": "int __tact_int_neq_nullable_one(int a, int b)", + "name": "__tact_string_builder_end_slice", + "signature": "slice __tact_string_builder_end_slice(tuple builders)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a == b ) : ( false ) );", + "code": "int sliceRefs = slice_refs(sc); +int sliceBits = slice_bits(sc); + +while((sliceBits > 0) | (sliceRefs > 0)) { + + ;; Load the current builder + (builder b, tuple tail) = uncons(builders); + int remBytes = 127 - (builder_bits(b) / 8); + int exBytes = sliceBits / 8; + + ;; Append bits + int amount = min(remBytes, exBytes); + if (amount > 0) { + slice read = sc~load_bits(amount * 8); + b = b.store_slice(read); + } + + ;; Update builders + builders = cons(b, tail); + + ;; Check if we need to add a new cell and continue + if (exBytes - amount > 0) { + var bb = begin_cell(); + builders = cons(bb, builders); + sliceBits = (exBytes - amount) * 8; + } elseif (sliceRefs > 0) { + sc = sc~load_ref().begin_parse(); + sliceRefs = slice_refs(sc); + sliceBits = slice_bits(sc); + } else { + sliceBits = 0; + sliceRefs = 0; + } +} + +return ((builders), ());", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_int_eq_nullable", - "signature": "int __tact_int_eq_nullable(int a, int b)", + "flags": Set {}, + "name": "__tact_string_builder_append", + "signature": "((tuple), ()) __tact_string_builder_append(tuple builders, slice sc)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a != b ) : ( true ) );", + "code": "builders~__tact_string_builder_append(sc); +return builders;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set { - "inline", + "depends": Set { + "__tact_string_builder_append", }, - "name": "__tact_int_neq_nullable", - "signature": "int __tact_int_neq_nullable(int a, int b)", + "flags": Set {}, + "name": "__tact_string_builder_append_not_mut", + "signature": "(tuple) __tact_string_builder_append_not_mut(tuple builders, slice sc)", }, { "code": { - "code": "return (a.cell_hash() == b.cell_hash());", + "code": "var b = begin_cell(); +if (src < 0) { + b = b.store_uint(45, 8); + src = - src; +} + +if (src < 1000000000000000000000000000000) { + int len = 0; + int value = 0; + int mult = 1; + do { + (src, int res) = src.divmod(10); + value = value + (res + 48) * mult; + mult = mult * 256; + len = len + 1; + } until (src == 0); + + b = b.store_uint(value, len * 8); +} else { + tuple t = empty_tuple(); + int len = 0; + do { + int digit = src % 10; + t~tpush(digit); + len = len + 1; + src = src / 10; + } until (src == 0); + + int c = len - 1; + repeat(len) { + int v = t.at(c); + b = b.store_uint(v + 48, 8); + c = c - 1; + } +} +return b.end_cell().begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_cell_eq", - "signature": "int __tact_cell_eq(cell a, cell b)", + "flags": Set {}, + "name": "__tact_int_to_string", + "signature": "slice __tact_int_to_string(int src)", }, { "code": { - "code": "return (a.cell_hash() != b.cell_hash());", + "code": "throw_if(134, (digits <= 0) | (digits > 77)); +builder b = begin_cell(); + +if (src < 0) { + b = b.store_uint(45, 8); + src = - src; +} + +;; Process rem part +int skip = true; +int len = 0; +int rem = 0; +tuple t = empty_tuple(); +repeat(digits) { + (src, rem) = src.divmod(10); + if ( ~ ( skip & ( rem == 0 ) ) ) { + skip = false; + t~tpush(rem + 48); + len = len + 1; + } +} + +;; Process dot +if (~ skip) { + t~tpush(46); + len = len + 1; +} + +;; Main +do { + (src, rem) = src.divmod(10); + t~tpush(rem + 48); + len = len + 1; +} until (src == 0); + +;; Assemble +int c = len - 1; +repeat(len) { + int v = t.at(c); + b = b.store_uint(v, 8); + c = c - 1; +} + +;; Result +return b.end_cell().begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_cell_neq", - "signature": "int __tact_cell_neq(cell a, cell b)", + "flags": Set {}, + "name": "__tact_float_to_string", + "signature": "slice __tact_float_to_string(int src, int digits)", }, { "code": { - "code": "return (null?(a)) ? (false) : (a.cell_hash() == b.cell_hash());", + "code": "throw_unless(5, num > 0); +throw_unless(5, base > 1); +if (num < base) { + return 0; +} +int result = 0; +while (num >= base) { + num /= base; + result += 1; +} +return result;", "kind": "generic", }, "comment": null, @@ -1752,12 +1680,17 @@ return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nu "flags": Set { "inline", }, - "name": "__tact_cell_eq_nullable_one", - "signature": "int __tact_cell_eq_nullable_one(cell a, cell b)", + "name": "__tact_log", + "signature": "int __tact_log(int num, int base)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a.cell_hash() != b.cell_hash());", + "code": "throw_unless(5, exp >= 0); +int result = 1; +repeat (exp) { + result *= base; +} +return result;", "kind": "generic", }, "comment": null, @@ -1766,579 +1699,710 @@ return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nu "flags": Set { "inline", }, - "name": "__tact_cell_neq_nullable_one", - "signature": "int __tact_cell_neq_nullable_one(cell a, cell b)", + "name": "__tact_pow", + "signature": "int __tact_pow(int base, int exp)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() == b.cell_hash() ) : ( false ) );", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_cell_eq_nullable", - "signature": "int __tact_cell_eq_nullable(cell a, cell b)", + "name": "__tact_dict_get_slice_slice", + "signature": "slice __tact_dict_get_slice_slice(cell d, int kl, slice k)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() != b.cell_hash() ) : ( true ) );", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_cell_neq_nullable", - "signature": "int __tact_cell_neq_nullable(cell a, cell b)", + "name": "__tact_dict_min_slice_slice", + "signature": "(slice, slice, int) __tact_dict_min_slice_slice(cell d, int kl)", }, { "code": { - "code": "return (a.slice_hash() == b.slice_hash());", + "code": "return __tact_dict_next(d, kl, pivot);", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq", - "signature": "int __tact_slice_eq(slice a, slice b)", + "name": "__tact_dict_next_slice_slice", + "signature": "(slice, slice, int) __tact_dict_next_slice_slice(cell d, int kl, slice pivot)", }, { "code": { - "code": "return (a.slice_hash() != b.slice_hash());", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq", - "signature": "int __tact_slice_neq(slice a, slice b)", + "name": "__tact_dict_set_slice_slice", + "signature": "(cell, ()) __tact_dict_set_slice_slice(cell d, int kl, slice k, slice v)", }, { "code": { - "code": "return (null?(a)) ? (false) : (a.slice_hash() == b.slice_hash());", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_nullable_one", - "signature": "int __tact_slice_eq_nullable_one(slice a, slice b)", + "name": "__tact_dict_get_slice_int", + "signature": "int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a.slice_hash() != b.slice_hash());", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq_nullable_one", - "signature": "int __tact_slice_neq_nullable_one(slice a, slice b)", + "name": "__tact_dict_min_slice_int", + "signature": "(slice, int, int) __tact_dict_min_slice_int(cell d, int kl, int vl)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() == b.slice_hash() ) : ( false ) );", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_nullable", - "signature": "int __tact_slice_eq_nullable(slice a, slice b)", + "name": "__tact_dict_next_slice_int", + "signature": "(slice, int, int) __tact_dict_next_slice_int(cell d, int kl, slice pivot, int vl)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() != b.slice_hash() ) : ( true ) );", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq_nullable", - "signature": "int __tact_slice_neq_nullable(slice a, slice b)", + "name": "__tact_dict_set_slice_int", + "signature": "(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl)", }, { "code": { - "code": "return udict_set_ref(dict, 16, id, code);", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_dict_set_code", - "signature": "cell __tact_dict_set_code(cell dict, int id, cell code)", + "name": "__tact_dict_get_slice_uint", + "signature": "int __tact_dict_get_slice_uint(cell d, int kl, slice k, int vl)", }, { "code": { - "code": "var (data, ok) = udict_get_ref?(dict, 16, id); -throw_unless(135, ok); -return data;", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_dict_get_code", - "signature": "cell __tact_dict_get_code(cell dict, int id)", + "name": "__tact_dict_min_slice_uint", + "signature": "(slice, int, int) __tact_dict_min_slice_uint(cell d, int kl, int vl)", }, { "code": { - "code": "NIL", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_0", - "signature": "tuple __tact_tuple_create_0()", + "depends": Set { + "__tact_dict_next", + }, + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_slice_uint", + "signature": "(slice, int, int) __tact_dict_next_slice_uint(cell d, int kl, slice pivot, int vl)", }, { "code": { - "code": "return ();", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_tuple_destroy_0", - "signature": "() __tact_tuple_destroy_0()", + "name": "__tact_dict_set_slice_uint", + "signature": "(cell, ()) __tact_dict_set_slice_uint(cell d, int kl, slice k, int v, int vl)", }, { "code": { - "code": "1 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = __tact_dict_get_ref(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_1", - "signature": "forall X0 -> tuple __tact_tuple_create_1((X0) v)", - }, - { - "code": { - "code": "1 UNTUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_get_ref", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_1", - "signature": "forall X0 -> (X0) __tact_tuple_destroy_1(tuple v)", - }, - { - "code": { - "code": "2 TUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_2", - "signature": "forall X0, X1 -> tuple __tact_tuple_create_2((X0, X1) v)", + "name": "__tact_dict_get_slice_cell", + "signature": "cell __tact_dict_get_slice_cell(cell d, int kl, slice k)", }, { "code": { - "code": "2 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_min_ref(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_2", - "signature": "forall X0, X1 -> (X0, X1) __tact_tuple_destroy_2(tuple v)", - }, - { - "code": { - "code": "3 TUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_min_ref", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_3", - "signature": "forall X0, X1, X2 -> tuple __tact_tuple_create_3((X0, X1, X2) v)", - }, - { - "code": { - "code": "3 UNTUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_3", - "signature": "forall X0, X1, X2 -> (X0, X1, X2) __tact_tuple_destroy_3(tuple v)", + "name": "__tact_dict_min_slice_cell", + "signature": "(slice, cell, int) __tact_dict_min_slice_cell(cell d, int kl)", }, { "code": { - "code": "4 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_4", - "signature": "forall X0, X1, X2, X3 -> tuple __tact_tuple_create_4((X0, X1, X2, X3) v)", - }, - { - "code": { - "code": "4 UNTUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_next", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_4", - "signature": "forall X0, X1, X2, X3 -> (X0, X1, X2, X3) __tact_tuple_destroy_4(tuple v)", - }, - { - "code": { - "code": "5 TUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_5", - "signature": "forall X0, X1, X2, X3, X4 -> tuple __tact_tuple_create_5((X0, X1, X2, X3, X4) v)", + "name": "__tact_dict_next_slice_cell", + "signature": "(slice, cell, int) __tact_dict_next_slice_cell(cell d, int kl, slice pivot)", }, { "code": { - "code": "5 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return __tact_dict_set_ref(d, kl, k, v); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_5", - "signature": "forall X0, X1, X2, X3, X4 -> (X0, X1, X2, X3, X4) __tact_tuple_destroy_5(tuple v)", - }, - { - "code": { - "code": "6 TUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_delete", + "__tact_dict_set_ref", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_6", - "signature": "forall X0, X1, X2, X3, X4, X5 -> tuple __tact_tuple_create_6((X0, X1, X2, X3, X4, X5) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_slice_cell", + "signature": "(cell, ()) __tact_dict_set_slice_cell(cell d, int kl, slice k, cell v)", }, { "code": { - "code": "6 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_6", - "signature": "forall X0, X1, X2, X3, X4, X5 -> (X0, X1, X2, X3, X4, X5) __tact_tuple_destroy_6(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_slice", + "signature": "slice __tact_dict_get_uint_slice(cell d, int kl, int k)", }, { "code": { - "code": "7 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_7", - "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> tuple __tact_tuple_create_7((X0, X1, X2, X3, X4, X5, X6) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_slice", + "signature": "(int, slice, int) __tact_dict_min_uint_slice(cell d, int kl)", }, { "code": { - "code": "7 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_7", - "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> (X0, X1, X2, X3, X4, X5, X6) __tact_tuple_destroy_7(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_slice", + "signature": "(int, slice, int) __tact_dict_next_uint_slice(cell d, int kl, int pivot)", }, { "code": { - "code": "8 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_8", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> tuple __tact_tuple_create_8((X0, X1, X2, X3, X4, X5, X6, X7) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_slice", + "signature": "(cell, ()) __tact_dict_set_uint_slice(cell d, int kl, int k, slice v)", }, { "code": { - "code": "8 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_8", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> (X0, X1, X2, X3, X4, X5, X6, X7) __tact_tuple_destroy_8(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_int", + "signature": "int __tact_dict_get_uint_int(cell d, int kl, int k, int vl)", }, { "code": { - "code": "9 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_9", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> tuple __tact_tuple_create_9((X0, X1, X2, X3, X4, X5, X6, X7, X8) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_int", + "signature": "(int, int, int) __tact_dict_min_uint_int(cell d, int kl, int vl)", }, { "code": { - "code": "9 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_9", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8) __tact_tuple_destroy_9(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_int", + "signature": "(int, int, int) __tact_dict_next_uint_int(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "10 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_10", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> tuple __tact_tuple_create_10((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_int", + "signature": "(cell, ()) __tact_dict_set_uint_int(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "10 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_10", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __tact_tuple_destroy_10(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_uint", + "signature": "int __tact_dict_get_uint_uint(cell d, int kl, int k, int vl)", }, { "code": { - "code": "11 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_11", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> tuple __tact_tuple_create_11((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_uint", + "signature": "(int, int, int) __tact_dict_min_uint_uint(cell d, int kl, int vl)", }, { "code": { - "code": "11 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_11", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __tact_tuple_destroy_11(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_uint", + "signature": "(int, int, int) __tact_dict_next_uint_uint(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "12 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_12", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> tuple __tact_tuple_create_12((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_uint", + "signature": "(cell, ()) __tact_dict_set_uint_uint(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "12 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get_ref?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_12", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __tact_tuple_destroy_12(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_cell", + "signature": "cell __tact_dict_get_uint_cell(cell d, int kl, int k)", }, { "code": { - "code": "13 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min_ref?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_13", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> tuple __tact_tuple_create_13((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_cell", + "signature": "(int, cell, int) __tact_dict_min_uint_cell(cell d, int kl)", }, { "code": { - "code": "13 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_13", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __tact_tuple_destroy_13(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_cell", + "signature": "(int, cell, int) __tact_dict_next_uint_cell(cell d, int kl, int pivot)", }, { "code": { - "code": "14 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_ref(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_14", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> tuple __tact_tuple_create_14((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_cell", + "signature": "(cell, ()) __tact_dict_set_uint_cell(cell d, int kl, int k, cell v)", }, { "code": { - "code": "14 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_14", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __tact_tuple_destroy_14(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_int_slice", + "signature": "slice __tact_dict_get_int_slice(cell d, int kl, int k)", }, { "code": { - "code": "15 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_15", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> tuple __tact_tuple_create_15((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_int_slice", + "signature": "(int, slice, int) __tact_dict_min_int_slice(cell d, int kl)", }, { "code": { - "code": "15 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_15", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __tact_tuple_destroy_15(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_int_slice", + "signature": "(int, slice, int) __tact_dict_next_int_slice(cell d, int kl, int pivot)", }, { "code": { - "code": "return tpush(tpush(empty_tuple(), b), null());", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set(d, kl, k, v), ()); +}", "kind": "generic", }, "comment": null, @@ -2347,66 +2411,74 @@ return data;", "flags": Set { "inline", }, - "name": "__tact_string_builder_start", - "signature": "tuple __tact_string_builder_start(builder b)", + "name": "__tact_dict_set_int_slice", + "signature": "(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 32));", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_comment", - "signature": "tuple __tact_string_builder_start_comment()", + "name": "__tact_dict_get_int_int", + "signature": "int __tact_dict_get_int_int(cell d, int kl, int k, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 8));", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_tail_string", - "signature": "tuple __tact_string_builder_start_tail_string()", + "name": "__tact_dict_min_int_int", + "signature": "(int, int, int) __tact_dict_min_int_int(cell d, int kl, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell());", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_string", - "signature": "tuple __tact_string_builder_start_string()", + "name": "__tact_dict_next_int_int", + "signature": "(int, int, int) __tact_dict_next_int_int(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "(builder b, tuple tail) = uncons(builders); -cell c = b.end_cell(); -while(~ null?(tail)) { - (b, tail) = uncons(tail); - c = b.store_ref(c).end_cell(); -} -return c;", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", "kind": "generic", }, "comment": null, @@ -2415,203 +2487,131 @@ return c;", "flags": Set { "inline", }, - "name": "__tact_string_builder_end", - "signature": "cell __tact_string_builder_end(tuple builders)", + "name": "__tact_dict_set_int_int", + "signature": "(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "return __tact_string_builder_end(builders).begin_parse();", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_end", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_end_slice", - "signature": "slice __tact_string_builder_end_slice(tuple builders)", + "name": "__tact_dict_get_int_uint", + "signature": "int __tact_dict_get_int_uint(cell d, int kl, int k, int vl)", }, { "code": { - "code": "int sliceRefs = slice_refs(sc); -int sliceBits = slice_bits(sc); - -while((sliceBits > 0) | (sliceRefs > 0)) { - - ;; Load the current builder - (builder b, tuple tail) = uncons(builders); - int remBytes = 127 - (builder_bits(b) / 8); - int exBytes = sliceBits / 8; - - ;; Append bits - int amount = min(remBytes, exBytes); - if (amount > 0) { - slice read = sc~load_bits(amount * 8); - b = b.store_slice(read); - } - - ;; Update builders - builders = cons(b, tail); - - ;; Check if we need to add a new cell and continue - if (exBytes - amount > 0) { - var bb = begin_cell(); - builders = cons(bb, builders); - sliceBits = (exBytes - amount) * 8; - } elseif (sliceRefs > 0) { - sc = sc~load_ref().begin_parse(); - sliceRefs = slice_refs(sc); - sliceBits = slice_bits(sc); - } else { - sliceBits = 0; - sliceRefs = 0; - } -} - -return ((builders), ());", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_string_builder_append", - "signature": "((tuple), ()) __tact_string_builder_append(tuple builders, slice sc)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_int_uint", + "signature": "(int, int, int) __tact_dict_min_int_uint(cell d, int kl, int vl)", }, { "code": { - "code": "builders~__tact_string_builder_append(sc); -return builders;", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_append", + "depends": Set {}, + "flags": Set { + "inline", }, - "flags": Set {}, - "name": "__tact_string_builder_append_not_mut", - "signature": "(tuple) __tact_string_builder_append_not_mut(tuple builders, slice sc)", + "name": "__tact_dict_next_int_uint", + "signature": "(int, int, int) __tact_dict_next_int_uint(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "var b = begin_cell(); -if (src < 0) { - b = b.store_uint(45, 8); - src = - src; -} - -if (src < 1000000000000000000000000000000) { - int len = 0; - int value = 0; - int mult = 1; - do { - (src, int res) = src.divmod(10); - value = value + (res + 48) * mult; - mult = mult * 256; - len = len + 1; - } until (src == 0); - - b = b.store_uint(value, len * 8); + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); } else { - tuple t = empty_tuple(); - int len = 0; - do { - int digit = src % 10; - t~tpush(digit); - len = len + 1; - src = src / 10; - } until (src == 0); - - int c = len - 1; - repeat(len) { - int v = t.at(c); - b = b.store_uint(v + 48, 8); - c = c - 1; - } -} -return b.end_cell().begin_parse();", + return (idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_int_uint", + "signature": "(cell, ()) __tact_dict_set_int_uint(cell d, int kl, int k, int v, int vl)", + }, + { + "code": { + "code": "var (r, ok) = idict_get_ref?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_int_to_string", - "signature": "slice __tact_int_to_string(int src)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_int_cell", + "signature": "cell __tact_dict_get_int_cell(cell d, int kl, int k)", }, { "code": { - "code": "throw_if(134, (digits <= 0) | (digits > 77)); -builder b = begin_cell(); - -if (src < 0) { - b = b.store_uint(45, 8); - src = - src; -} - -;; Process rem part -int skip = true; -int len = 0; -int rem = 0; -tuple t = empty_tuple(); -repeat(digits) { - (src, rem) = src.divmod(10); - if ( ~ ( skip & ( rem == 0 ) ) ) { - skip = false; - t~tpush(rem + 48); - len = len + 1; - } -} - -;; Process dot -if (~ skip) { - t~tpush(46); - len = len + 1; -} - -;; Main -do { - (src, rem) = src.divmod(10); - t~tpush(rem + 48); - len = len + 1; -} until (src == 0); - -;; Assemble -int c = len - 1; -repeat(len) { - int v = t.at(c); - b = b.store_uint(v, 8); - c = c - 1; -} - -;; Result -return b.end_cell().begin_parse();", + "code": "var (key, value, flag) = idict_get_min_ref?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_float_to_string", - "signature": "slice __tact_float_to_string(int src, int digits)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_int_cell", + "signature": "(int, cell, int) __tact_dict_min_int_cell(cell d, int kl)", }, { "code": { - "code": "throw_unless(5, num > 0); -throw_unless(5, base > 1); -if (num < base) { - return 0; -} -int result = 0; -while (num >= base) { - num /= base; - result += 1; -} -return result;", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, @@ -2620,17 +2620,17 @@ return result;", "flags": Set { "inline", }, - "name": "__tact_log", - "signature": "int __tact_log(int num, int base)", + "name": "__tact_dict_next_int_cell", + "signature": "(int, cell, int) __tact_dict_next_int_cell(cell d, int kl, int pivot)", }, { "code": { - "code": "throw_unless(5, exp >= 0); -int result = 1; -repeat (exp) { - result *= base; -} -return result;", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_ref(d, kl, k, v), ()); +}", "kind": "generic", }, "comment": null, @@ -2639,23 +2639,25 @@ return result;", "flags": Set { "inline", }, - "name": "__tact_pow", - "signature": "int __tact_pow(int base, int exp)", + "name": "__tact_dict_set_int_cell", + "signature": "(cell, ()) __tact_dict_set_int_cell(cell d, int kl, int k, cell v)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); + "code": "var (r, ok) = __tact_dict_get(d, kl, k); return ok;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_dict_exists_int", - "signature": "int __tact_dict_exists_int(cell d, int kl, int k)", + "name": "__tact_dict_exists_slice", + "signature": "int __tact_dict_exists_slice(cell d, int kl, slice k)", }, { "code": { @@ -2674,20 +2676,18 @@ return ok;", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); + "code": "var (r, ok) = idict_get?(d, kl, k); return ok;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_dict_exists_slice", - "signature": "int __tact_dict_exists_slice(cell d, int kl, slice k)", + "name": "__tact_dict_exists_int", + "signature": "int __tact_dict_exists_int(cell d, int kl, int k)", }, { "code": { @@ -4124,44 +4124,171 @@ return __tact_base64_encode(user_friendly_address_with_checksum);", "flags": Set { "inline", }, - "name": "__tact_context_get", - "signature": "(int, slice, int, slice) __tact_context_get()", + "name": "__tact_context_get", + "signature": "(int, slice, int, slice) __tact_context_get()", + }, + { + "code": { + "code": "return __tact_context_sender;", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "inline", + }, + "name": "__tact_context_get_sender", + "signature": "slice __tact_context_get_sender()", + }, + { + "code": { + "code": "if (null?(__tact_randomized)) { + randomize_lt(); + __tact_randomized = true; +}", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "impure", + "inline", + }, + "name": "__tact_prepare_random", + "signature": "() __tact_prepare_random()", + }, + { + "code": { + "code": "return b.store_int(v, 1);", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "inline", + }, + "name": "__tact_store_bool", + "signature": "builder __tact_store_bool(builder b, int v)", + }, + { + "code": { + "code": "NOP", + "kind": "asm", + "shuffle": "", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_to_tuple", + "signature": "forall X -> tuple __tact_to_tuple(X x)", + }, + { + "code": { + "code": "NOP", + "kind": "asm", + "shuffle": "", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_from_tuple", + "signature": "forall X -> X __tact_from_tuple(tuple x)", + }, + { + "code": { + "code": "return equal_slices_bits(a, b);", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "inline", + }, + "name": "__tact_slice_eq_bits", + "signature": "int __tact_slice_eq_bits(slice a, slice b)", + }, + { + "code": { + "code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "inline", + }, + "name": "__tact_slice_eq_bits_nullable_one", + "signature": "int __tact_slice_eq_bits_nullable_one(slice a, slice b)", + }, + { + "code": { + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "inline", + }, + "name": "__tact_slice_eq_bits_nullable", + "signature": "int __tact_slice_eq_bits_nullable(slice a, slice b)", }, { "code": { - "code": "return __tact_context_sender;", + "code": "(slice key, slice value, int flag) = __tact_dict_min(a, kl); +while (flag) { + (slice value_b, int flag_b) = b~__tact_dict_delete_get(kl, key); + ifnot (flag_b) { + return 0; + } + ifnot (value.slice_hash() == value_b.slice_hash()) { + return 0; + } + (key, value, flag) = __tact_dict_next(a, kl, key); +} +return null?(b);", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + "__tact_dict_delete_get", + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_context_get_sender", - "signature": "slice __tact_context_get_sender()", + "name": "__tact_dict_eq", + "signature": "int __tact_dict_eq(cell a, cell b, int kl)", }, { "code": { - "code": "if (null?(__tact_randomized)) { - randomize_lt(); - __tact_randomized = true; -}", + "code": "return (null?(a)) ? (false) : (a == b);", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, "flags": Set { - "impure", "inline", }, - "name": "__tact_prepare_random", - "signature": "() __tact_prepare_random()", + "name": "__tact_int_eq_nullable_one", + "signature": "int __tact_int_eq_nullable_one(int a, int b)", }, { "code": { - "code": "return b.store_int(v, 1);", + "code": "return (null?(a)) ? (true) : (a != b);", "kind": "generic", }, "comment": null, @@ -4170,43 +4297,44 @@ return __tact_base64_encode(user_friendly_address_with_checksum);", "flags": Set { "inline", }, - "name": "__tact_store_bool", - "signature": "builder __tact_store_bool(builder b, int v)", + "name": "__tact_int_neq_nullable_one", + "signature": "int __tact_int_neq_nullable_one(int a, int b)", }, { "code": { - "code": "NOP", - "kind": "asm", - "shuffle": "", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a == b ) : ( false ) );", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_to_tuple", - "signature": "forall X -> tuple __tact_to_tuple(X x)", + "flags": Set { + "inline", + }, + "name": "__tact_int_eq_nullable", + "signature": "int __tact_int_eq_nullable(int a, int b)", }, { "code": { - "code": "NOP", - "kind": "asm", - "shuffle": "", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a != b ) : ( true ) );", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_from_tuple", - "signature": "forall X -> X __tact_from_tuple(tuple x)", + "flags": Set { + "inline", + }, + "name": "__tact_int_neq_nullable", + "signature": "int __tact_int_neq_nullable(int a, int b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", + "code": "return (a.cell_hash() == b.cell_hash());", "kind": "generic", }, "comment": null, @@ -4215,17 +4343,12 @@ return __tact_base64_encode(user_friendly_address_with_checksum);", "flags": Set { "inline", }, - "name": "__tact_dict_set_int_int", - "signature": "(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl)", + "name": "__tact_cell_eq", + "signature": "int __tact_cell_eq(cell a, cell b)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", + "code": "return (a.cell_hash() != b.cell_hash());", "kind": "generic", }, "comment": null, @@ -4234,17 +4357,12 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_int", - "signature": "int __tact_dict_get_int_int(cell d, int kl, int k, int vl)", + "name": "__tact_cell_neq", + "signature": "int __tact_cell_neq(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (null?(a)) ? (false) : (a.cell_hash() == b.cell_hash());", "kind": "generic", }, "comment": null, @@ -4253,17 +4371,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_int", - "signature": "(int, int, int) __tact_dict_min_int_int(cell d, int kl, int vl)", + "name": "__tact_cell_eq_nullable_one", + "signature": "int __tact_cell_eq_nullable_one(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (null?(a)) ? (true) : (a.cell_hash() != b.cell_hash());", "kind": "generic", }, "comment": null, @@ -4272,17 +4385,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_int_int", - "signature": "(int, int, int) __tact_dict_next_int_int(cell d, int kl, int pivot, int vl)", + "name": "__tact_cell_neq_nullable_one", + "signature": "int __tact_cell_neq_nullable_one(cell a, cell b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() == b.cell_hash() ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -4291,17 +4401,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_int_uint", - "signature": "(cell, ()) __tact_dict_set_int_uint(cell d, int kl, int k, int v, int vl)", + "name": "__tact_cell_eq_nullable", + "signature": "int __tact_cell_eq_nullable(cell a, cell b)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() != b.cell_hash() ) : ( true ) );", "kind": "generic", }, "comment": null, @@ -4310,17 +4417,12 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_uint", - "signature": "int __tact_dict_get_int_uint(cell d, int kl, int k, int vl)", + "name": "__tact_cell_neq_nullable", + "signature": "int __tact_cell_neq_nullable(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (a.slice_hash() == b.slice_hash());", "kind": "generic", }, "comment": null, @@ -4329,17 +4431,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_uint", - "signature": "(int, int, int) __tact_dict_min_int_uint(cell d, int kl, int vl)", + "name": "__tact_slice_eq", + "signature": "int __tact_slice_eq(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (a.slice_hash() != b.slice_hash());", "kind": "generic", }, "comment": null, @@ -4348,17 +4445,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_int_uint", - "signature": "(int, int, int) __tact_dict_next_int_uint(cell d, int kl, int pivot, int vl)", + "name": "__tact_slice_neq", + "signature": "int __tact_slice_neq(slice a, slice b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", + "code": "return (null?(a)) ? (false) : (a.slice_hash() == b.slice_hash());", "kind": "generic", }, "comment": null, @@ -4367,17 +4459,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_uint_int", - "signature": "(cell, ()) __tact_dict_set_uint_int(cell d, int kl, int k, int v, int vl)", + "name": "__tact_slice_eq_nullable_one", + "signature": "int __tact_slice_eq_nullable_one(slice a, slice b)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", + "code": "return (null?(a)) ? (true) : (a.slice_hash() != b.slice_hash());", "kind": "generic", }, "comment": null, @@ -4386,17 +4473,14 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_int", - "signature": "int __tact_dict_get_uint_int(cell d, int kl, int k, int vl)", + "name": "__tact_slice_neq_nullable_one", + "signature": "int __tact_slice_neq_nullable_one(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() == b.slice_hash() ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -4405,17 +4489,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_uint_int", - "signature": "(int, int, int) __tact_dict_min_uint_int(cell d, int kl, int vl)", + "name": "__tact_slice_eq_nullable", + "signature": "int __tact_slice_eq_nullable(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() != b.slice_hash() ) : ( true ) );", "kind": "generic", }, "comment": null, @@ -4424,17 +4505,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_uint_int", - "signature": "(int, int, int) __tact_dict_next_uint_int(cell d, int kl, int pivot, int vl)", + "name": "__tact_slice_neq_nullable", + "signature": "int __tact_slice_neq_nullable(slice a, slice b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", + "code": "return udict_set_ref(dict, 16, id, code);", "kind": "generic", }, "comment": null, @@ -4443,17 +4519,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_uint_uint", - "signature": "(cell, ()) __tact_dict_set_uint_uint(cell d, int kl, int k, int v, int vl)", + "name": "__tact_dict_set_code", + "signature": "cell __tact_dict_set_code(cell dict, int id, cell code)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", + "code": "var (data, ok) = udict_get_ref?(dict, 16, id); +throw_unless(135, ok); +return data;", "kind": "generic", }, "comment": null, @@ -4462,17 +4535,25 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_uint", - "signature": "int __tact_dict_get_uint_uint(cell d, int kl, int k, int vl)", + "name": "__tact_dict_get_code", + "signature": "cell __tact_dict_get_code(cell dict, int id)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "NIL", + "kind": "asm", + "shuffle": "", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_0", + "signature": "tuple __tact_tuple_create_0()", + }, + { + "code": { + "code": "return ();", "kind": "generic", }, "comment": null, @@ -4481,681 +4562,470 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_uint_uint", - "signature": "(int, int, int) __tact_dict_min_uint_uint(cell d, int kl, int vl)", + "name": "__tact_tuple_destroy_0", + "signature": "() __tact_tuple_destroy_0()", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "1 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_uint_uint", - "signature": "(int, int, int) __tact_dict_next_uint_uint(cell d, int kl, int pivot, int vl)", + "flags": Set {}, + "name": "__tact_tuple_create_1", + "signature": "forall X0 -> tuple __tact_tuple_create_1((X0) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_ref(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "1 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_int_cell", - "signature": "(cell, ()) __tact_dict_set_int_cell(cell d, int kl, int k, cell v)", + "flags": Set {}, + "name": "__tact_tuple_destroy_1", + "signature": "forall X0 -> (X0) __tact_tuple_destroy_1(tuple v)", }, { "code": { - "code": "var (r, ok) = idict_get_ref?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "2 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_int_cell", - "signature": "cell __tact_dict_get_int_cell(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_create_2", + "signature": "forall X0, X1 -> tuple __tact_tuple_create_2((X0, X1) v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min_ref?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "2 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_int_cell", - "signature": "(int, cell, int) __tact_dict_min_int_cell(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_destroy_2", + "signature": "forall X0, X1 -> (X0, X1) __tact_tuple_destroy_2(tuple v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "3 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_int_cell", - "signature": "(int, cell, int) __tact_dict_next_int_cell(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_create_3", + "signature": "forall X0, X1, X2 -> tuple __tact_tuple_create_3((X0, X1, X2) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_ref(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "3 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_uint_cell", - "signature": "(cell, ()) __tact_dict_set_uint_cell(cell d, int kl, int k, cell v)", + "flags": Set {}, + "name": "__tact_tuple_destroy_3", + "signature": "forall X0, X1, X2 -> (X0, X1, X2) __tact_tuple_destroy_3(tuple v)", }, { "code": { - "code": "var (r, ok) = udict_get_ref?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "4 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_uint_cell", - "signature": "cell __tact_dict_get_uint_cell(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_create_4", + "signature": "forall X0, X1, X2, X3 -> tuple __tact_tuple_create_4((X0, X1, X2, X3) v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min_ref?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "4 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_uint_cell", - "signature": "(int, cell, int) __tact_dict_min_uint_cell(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_destroy_4", + "signature": "forall X0, X1, X2, X3 -> (X0, X1, X2, X3) __tact_tuple_destroy_4(tuple v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "5 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_uint_cell", - "signature": "(int, cell, int) __tact_dict_next_uint_cell(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_create_5", + "signature": "forall X0, X1, X2, X3, X4 -> tuple __tact_tuple_create_5((X0, X1, X2, X3, X4) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "5 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_int_slice", - "signature": "(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v)", + "flags": Set {}, + "name": "__tact_tuple_destroy_5", + "signature": "forall X0, X1, X2, X3, X4 -> (X0, X1, X2, X3, X4) __tact_tuple_destroy_5(tuple v)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "6 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_int_slice", - "signature": "slice __tact_dict_get_int_slice(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_create_6", + "signature": "forall X0, X1, X2, X3, X4, X5 -> tuple __tact_tuple_create_6((X0, X1, X2, X3, X4, X5) v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "6 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_int_slice", - "signature": "(int, slice, int) __tact_dict_min_int_slice(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_destroy_6", + "signature": "forall X0, X1, X2, X3, X4, X5 -> (X0, X1, X2, X3, X4, X5) __tact_tuple_destroy_6(tuple v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "7 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_int_slice", - "signature": "(int, slice, int) __tact_dict_next_int_slice(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_create_7", + "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> tuple __tact_tuple_create_7((X0, X1, X2, X3, X4, X5, X6) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "7 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_uint_slice", - "signature": "(cell, ()) __tact_dict_set_uint_slice(cell d, int kl, int k, slice v)", + "flags": Set {}, + "name": "__tact_tuple_destroy_7", + "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> (X0, X1, X2, X3, X4, X5, X6) __tact_tuple_destroy_7(tuple v)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "8 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_uint_slice", - "signature": "slice __tact_dict_get_uint_slice(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_create_8", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> tuple __tact_tuple_create_8((X0, X1, X2, X3, X4, X5, X6, X7) v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "8 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_uint_slice", - "signature": "(int, slice, int) __tact_dict_min_uint_slice(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_destroy_8", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> (X0, X1, X2, X3, X4, X5, X6, X7) __tact_tuple_destroy_8(tuple v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "9 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_uint_slice", - "signature": "(int, slice, int) __tact_dict_next_uint_slice(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_create_9", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> tuple __tact_tuple_create_9((X0, X1, X2, X3, X4, X5, X6, X7, X8) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", - "kind": "generic", + "code": "9 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_int", - "signature": "(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_9", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8) __tact_tuple_destroy_9(tuple v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", - "kind": "generic", + "code": "10 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_int", - "signature": "int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_10", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> tuple __tact_tuple_create_10((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "10 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_int", - "signature": "(slice, int, int) __tact_dict_min_slice_int(cell d, int kl, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_10", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __tact_tuple_destroy_10(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "11 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_int", - "signature": "(slice, int, int) __tact_dict_next_slice_int(cell d, int kl, slice pivot, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_11", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> tuple __tact_tuple_create_11((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", - "kind": "generic", + "code": "11 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_uint", - "signature": "(cell, ()) __tact_dict_set_slice_uint(cell d, int kl, slice k, int v, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_11", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __tact_tuple_destroy_11(tuple v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", - "kind": "generic", + "code": "12 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_uint", - "signature": "int __tact_dict_get_slice_uint(cell d, int kl, slice k, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_12", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> tuple __tact_tuple_create_12((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "12 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_uint", - "signature": "(slice, int, int) __tact_dict_min_slice_uint(cell d, int kl, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_12", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __tact_tuple_destroy_12(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "13 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_uint", - "signature": "(slice, int, int) __tact_dict_next_slice_uint(cell d, int kl, slice pivot, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_13", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> tuple __tact_tuple_create_13((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return __tact_dict_set_ref(d, kl, k, v); -}", - "kind": "generic", + "code": "13 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - "__tact_dict_set_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_cell", - "signature": "(cell, ()) __tact_dict_set_slice_cell(cell d, int kl, slice k, cell v)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_13", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __tact_tuple_destroy_13(tuple v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get_ref(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "14 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_cell", - "signature": "cell __tact_dict_get_slice_cell(cell d, int kl, slice k)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_14", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> tuple __tact_tuple_create_14((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min_ref(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "14 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_cell", - "signature": "(slice, cell, int) __tact_dict_min_slice_cell(cell d, int kl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_14", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __tact_tuple_destroy_14(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "15 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_cell", - "signature": "(slice, cell, int) __tact_dict_next_slice_cell(cell d, int kl, slice pivot)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_15", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> tuple __tact_tuple_create_15((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ()); -}", - "kind": "generic", + "code": "15 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_slice", - "signature": "(cell, ()) __tact_dict_set_slice_slice(cell d, int kl, slice k, slice v)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_15", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __tact_tuple_destroy_15(tuple v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", + "code": "return tpush(tpush(empty_tuple(), b), null());", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_dict_get_slice_slice", - "signature": "slice __tact_dict_get_slice_slice(cell d, int kl, slice k)", + "name": "__tact_string_builder_start", + "signature": "tuple __tact_string_builder_start(builder b)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", + "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 32));", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set { - "__tact_dict_min", + "__tact_string_builder_start", }, "flags": Set { "inline", }, - "name": "__tact_dict_min_slice_slice", - "signature": "(slice, slice, int) __tact_dict_min_slice_slice(cell d, int kl)", + "name": "__tact_string_builder_start_comment", + "signature": "tuple __tact_string_builder_start_comment()", }, { "code": { - "code": "return __tact_dict_next(d, kl, pivot);", + "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 8));", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set { - "__tact_dict_next", + "__tact_string_builder_start", }, "flags": Set { "inline", }, - "name": "__tact_dict_next_slice_slice", - "signature": "(slice, slice, int) __tact_dict_next_slice_slice(cell d, int kl, slice pivot)", + "name": "__tact_string_builder_start_tail_string", + "signature": "tuple __tact_string_builder_start_tail_string()", }, { "code": { - "code": "return equal_slices_bits(a, b);", + "code": "return __tact_string_builder_start(begin_cell());", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_start", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_bits", - "signature": "int __tact_slice_eq_bits(slice a, slice b)", + "name": "__tact_string_builder_start_string", + "signature": "tuple __tact_string_builder_start_string()", }, { "code": { - "code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));", + "code": "(builder b, tuple tail) = uncons(builders); +cell c = b.end_cell(); +while(~ null?(tail)) { + (b, tail) = uncons(tail); + c = b.store_ref(c).end_cell(); +} +return c;", "kind": "generic", }, "comment": null, @@ -5164,103 +5034,203 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_slice_eq_bits_nullable_one", - "signature": "int __tact_slice_eq_bits_nullable_one(slice a, slice b)", + "name": "__tact_string_builder_end", + "signature": "cell __tact_string_builder_end(tuple builders)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );", + "code": "return __tact_string_builder_end(builders).begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_end", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_bits_nullable", - "signature": "int __tact_slice_eq_bits_nullable(slice a, slice b)", + "name": "__tact_string_builder_end_slice", + "signature": "slice __tact_string_builder_end_slice(tuple builders)", }, { "code": { - "code": "(slice key, slice value, int flag) = __tact_dict_min(a, kl); -while (flag) { - (slice value_b, int flag_b) = b~__tact_dict_delete_get(kl, key); - ifnot (flag_b) { - return 0; + "code": "int sliceRefs = slice_refs(sc); +int sliceBits = slice_bits(sc); + +while((sliceBits > 0) | (sliceRefs > 0)) { + + ;; Load the current builder + (builder b, tuple tail) = uncons(builders); + int remBytes = 127 - (builder_bits(b) / 8); + int exBytes = sliceBits / 8; + + ;; Append bits + int amount = min(remBytes, exBytes); + if (amount > 0) { + slice read = sc~load_bits(amount * 8); + b = b.store_slice(read); } - ifnot (value.slice_hash() == value_b.slice_hash()) { - return 0; + + ;; Update builders + builders = cons(b, tail); + + ;; Check if we need to add a new cell and continue + if (exBytes - amount > 0) { + var bb = begin_cell(); + builders = cons(bb, builders); + sliceBits = (exBytes - amount) * 8; + } elseif (sliceRefs > 0) { + sc = sc~load_ref().begin_parse(); + sliceRefs = slice_refs(sc); + sliceBits = slice_bits(sc); + } else { + sliceBits = 0; + sliceRefs = 0; } - (key, value, flag) = __tact_dict_next(a, kl, key); } -return null?(b);", + +return ((builders), ());", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - "__tact_dict_delete_get", - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_eq", - "signature": "int __tact_dict_eq(cell a, cell b, int kl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_string_builder_append", + "signature": "((tuple), ()) __tact_string_builder_append(tuple builders, slice sc)", }, { "code": { - "code": "return (null?(a)) ? (false) : (a == b);", + "code": "builders~__tact_string_builder_append(sc); +return builders;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set { - "inline", + "depends": Set { + "__tact_string_builder_append", }, - "name": "__tact_int_eq_nullable_one", - "signature": "int __tact_int_eq_nullable_one(int a, int b)", + "flags": Set {}, + "name": "__tact_string_builder_append_not_mut", + "signature": "(tuple) __tact_string_builder_append_not_mut(tuple builders, slice sc)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a != b);", + "code": "var b = begin_cell(); +if (src < 0) { + b = b.store_uint(45, 8); + src = - src; +} + +if (src < 1000000000000000000000000000000) { + int len = 0; + int value = 0; + int mult = 1; + do { + (src, int res) = src.divmod(10); + value = value + (res + 48) * mult; + mult = mult * 256; + len = len + 1; + } until (src == 0); + + b = b.store_uint(value, len * 8); +} else { + tuple t = empty_tuple(); + int len = 0; + do { + int digit = src % 10; + t~tpush(digit); + len = len + 1; + src = src / 10; + } until (src == 0); + + int c = len - 1; + repeat(len) { + int v = t.at(c); + b = b.store_uint(v + 48, 8); + c = c - 1; + } +} +return b.end_cell().begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_int_neq_nullable_one", - "signature": "int __tact_int_neq_nullable_one(int a, int b)", + "flags": Set {}, + "name": "__tact_int_to_string", + "signature": "slice __tact_int_to_string(int src)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a == b ) : ( false ) );", + "code": "throw_if(134, (digits <= 0) | (digits > 77)); +builder b = begin_cell(); + +if (src < 0) { + b = b.store_uint(45, 8); + src = - src; +} + +;; Process rem part +int skip = true; +int len = 0; +int rem = 0; +tuple t = empty_tuple(); +repeat(digits) { + (src, rem) = src.divmod(10); + if ( ~ ( skip & ( rem == 0 ) ) ) { + skip = false; + t~tpush(rem + 48); + len = len + 1; + } +} + +;; Process dot +if (~ skip) { + t~tpush(46); + len = len + 1; +} + +;; Main +do { + (src, rem) = src.divmod(10); + t~tpush(rem + 48); + len = len + 1; +} until (src == 0); + +;; Assemble +int c = len - 1; +repeat(len) { + int v = t.at(c); + b = b.store_uint(v, 8); + c = c - 1; +} + +;; Result +return b.end_cell().begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_int_eq_nullable", - "signature": "int __tact_int_eq_nullable(int a, int b)", + "flags": Set {}, + "name": "__tact_float_to_string", + "signature": "slice __tact_float_to_string(int src, int digits)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a != b ) : ( true ) );", + "code": "throw_unless(5, num > 0); +throw_unless(5, base > 1); +if (num < base) { + return 0; +} +int result = 0; +while (num >= base) { + num /= base; + result += 1; +} +return result;", "kind": "generic", }, "comment": null, @@ -5269,12 +5239,17 @@ return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nu "flags": Set { "inline", }, - "name": "__tact_int_neq_nullable", - "signature": "int __tact_int_neq_nullable(int a, int b)", + "name": "__tact_log", + "signature": "int __tact_log(int num, int base)", }, { "code": { - "code": "return (a.cell_hash() == b.cell_hash());", + "code": "throw_unless(5, exp >= 0); +int result = 1; +repeat (exp) { + result *= base; +} +return result;", "kind": "generic", }, "comment": null, @@ -5283,621 +5258,729 @@ return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nu "flags": Set { "inline", }, - "name": "__tact_cell_eq", - "signature": "int __tact_cell_eq(cell a, cell b)", + "name": "__tact_pow", + "signature": "int __tact_pow(int base, int exp)", }, { "code": { - "code": "return (a.cell_hash() != b.cell_hash());", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_cell_neq", - "signature": "int __tact_cell_neq(cell a, cell b)", - }, - { - "code": { - "code": "return (null?(a)) ? (false) : (a.cell_hash() == b.cell_hash());", - "kind": "generic", + "depends": Set { + "__tact_dict_get", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_cell_eq_nullable_one", - "signature": "int __tact_cell_eq_nullable_one(cell a, cell b)", + "name": "__tact_dict_get_slice_slice", + "signature": "slice __tact_dict_get_slice_slice(cell d, int kl, slice k)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a.cell_hash() != b.cell_hash());", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_cell_neq_nullable_one", - "signature": "int __tact_cell_neq_nullable_one(cell a, cell b)", + "name": "__tact_dict_min_slice_slice", + "signature": "(slice, slice, int) __tact_dict_min_slice_slice(cell d, int kl)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() == b.cell_hash() ) : ( false ) );", + "code": "return __tact_dict_next(d, kl, pivot);", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_cell_eq_nullable", - "signature": "int __tact_cell_eq_nullable(cell a, cell b)", + "name": "__tact_dict_next_slice_slice", + "signature": "(slice, slice, int) __tact_dict_next_slice_slice(cell d, int kl, slice pivot)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() != b.cell_hash() ) : ( true ) );", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_cell_neq_nullable", - "signature": "int __tact_cell_neq_nullable(cell a, cell b)", + "name": "__tact_dict_set_slice_slice", + "signature": "(cell, ()) __tact_dict_set_slice_slice(cell d, int kl, slice k, slice v)", }, { "code": { - "code": "return (a.slice_hash() == b.slice_hash());", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq", - "signature": "int __tact_slice_eq(slice a, slice b)", + "name": "__tact_dict_get_slice_int", + "signature": "int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl)", }, { "code": { - "code": "return (a.slice_hash() != b.slice_hash());", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq", - "signature": "int __tact_slice_neq(slice a, slice b)", + "name": "__tact_dict_min_slice_int", + "signature": "(slice, int, int) __tact_dict_min_slice_int(cell d, int kl, int vl)", }, { "code": { - "code": "return (null?(a)) ? (false) : (a.slice_hash() == b.slice_hash());", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_nullable_one", - "signature": "int __tact_slice_eq_nullable_one(slice a, slice b)", + "name": "__tact_dict_next_slice_int", + "signature": "(slice, int, int) __tact_dict_next_slice_int(cell d, int kl, slice pivot, int vl)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a.slice_hash() != b.slice_hash());", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq_nullable_one", - "signature": "int __tact_slice_neq_nullable_one(slice a, slice b)", + "name": "__tact_dict_set_slice_int", + "signature": "(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() == b.slice_hash() ) : ( false ) );", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_nullable", - "signature": "int __tact_slice_eq_nullable(slice a, slice b)", + "name": "__tact_dict_get_slice_uint", + "signature": "int __tact_dict_get_slice_uint(cell d, int kl, slice k, int vl)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() != b.slice_hash() ) : ( true ) );", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq_nullable", - "signature": "int __tact_slice_neq_nullable(slice a, slice b)", + "name": "__tact_dict_min_slice_uint", + "signature": "(slice, int, int) __tact_dict_min_slice_uint(cell d, int kl, int vl)", }, { "code": { - "code": "return udict_set_ref(dict, 16, id, code);", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_dict_set_code", - "signature": "cell __tact_dict_set_code(cell dict, int id, cell code)", + "name": "__tact_dict_next_slice_uint", + "signature": "(slice, int, int) __tact_dict_next_slice_uint(cell d, int kl, slice pivot, int vl)", }, { "code": { - "code": "var (data, ok) = udict_get_ref?(dict, 16, id); -throw_unless(135, ok); -return data;", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_dict_get_code", - "signature": "cell __tact_dict_get_code(cell dict, int id)", - }, - { - "code": { - "code": "NIL", - "kind": "asm", - "shuffle": "", - }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_0", - "signature": "tuple __tact_tuple_create_0()", + "name": "__tact_dict_set_slice_uint", + "signature": "(cell, ()) __tact_dict_set_slice_uint(cell d, int kl, slice k, int v, int vl)", }, { "code": { - "code": "return ();", + "code": "var (r, ok) = __tact_dict_get_ref(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get_ref", + }, "flags": Set { "inline", }, - "name": "__tact_tuple_destroy_0", - "signature": "() __tact_tuple_destroy_0()", + "name": "__tact_dict_get_slice_cell", + "signature": "cell __tact_dict_get_slice_cell(cell d, int kl, slice k)", }, { "code": { - "code": "1 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_min_ref(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_1", - "signature": "forall X0 -> tuple __tact_tuple_create_1((X0) v)", - }, - { - "code": { - "code": "1 UNTUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_min_ref", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_1", - "signature": "forall X0 -> (X0) __tact_tuple_destroy_1(tuple v)", - }, - { - "code": { - "code": "2 TUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_2", - "signature": "forall X0, X1 -> tuple __tact_tuple_create_2((X0, X1) v)", + "name": "__tact_dict_min_slice_cell", + "signature": "(slice, cell, int) __tact_dict_min_slice_cell(cell d, int kl)", }, { "code": { - "code": "2 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_2", - "signature": "forall X0, X1 -> (X0, X1) __tact_tuple_destroy_2(tuple v)", - }, - { - "code": { - "code": "3 TUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_next", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_3", - "signature": "forall X0, X1, X2 -> tuple __tact_tuple_create_3((X0, X1, X2) v)", - }, - { - "code": { - "code": "3 UNTUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_3", - "signature": "forall X0, X1, X2 -> (X0, X1, X2) __tact_tuple_destroy_3(tuple v)", + "name": "__tact_dict_next_slice_cell", + "signature": "(slice, cell, int) __tact_dict_next_slice_cell(cell d, int kl, slice pivot)", }, { "code": { - "code": "4 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return __tact_dict_set_ref(d, kl, k, v); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_4", - "signature": "forall X0, X1, X2, X3 -> tuple __tact_tuple_create_4((X0, X1, X2, X3) v)", - }, - { - "code": { - "code": "4 UNTUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_delete", + "__tact_dict_set_ref", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_4", - "signature": "forall X0, X1, X2, X3 -> (X0, X1, X2, X3) __tact_tuple_destroy_4(tuple v)", - }, - { - "code": { - "code": "5 TUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_5", - "signature": "forall X0, X1, X2, X3, X4 -> tuple __tact_tuple_create_5((X0, X1, X2, X3, X4) v)", + "name": "__tact_dict_set_slice_cell", + "signature": "(cell, ()) __tact_dict_set_slice_cell(cell d, int kl, slice k, cell v)", }, { "code": { - "code": "5 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_5", - "signature": "forall X0, X1, X2, X3, X4 -> (X0, X1, X2, X3, X4) __tact_tuple_destroy_5(tuple v)", - }, - { - "code": { - "code": "6 TUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_6", - "signature": "forall X0, X1, X2, X3, X4, X5 -> tuple __tact_tuple_create_6((X0, X1, X2, X3, X4, X5) v)", + "name": "__tact_dict_get_uint_slice", + "signature": "slice __tact_dict_get_uint_slice(cell d, int kl, int k)", }, { "code": { - "code": "6 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_6", - "signature": "forall X0, X1, X2, X3, X4, X5 -> (X0, X1, X2, X3, X4, X5) __tact_tuple_destroy_6(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_slice", + "signature": "(int, slice, int) __tact_dict_min_uint_slice(cell d, int kl)", }, { "code": { - "code": "7 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_7", - "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> tuple __tact_tuple_create_7((X0, X1, X2, X3, X4, X5, X6) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_slice", + "signature": "(int, slice, int) __tact_dict_next_uint_slice(cell d, int kl, int pivot)", }, { "code": { - "code": "7 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_7", - "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> (X0, X1, X2, X3, X4, X5, X6) __tact_tuple_destroy_7(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_slice", + "signature": "(cell, ()) __tact_dict_set_uint_slice(cell d, int kl, int k, slice v)", }, { "code": { - "code": "8 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_8", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> tuple __tact_tuple_create_8((X0, X1, X2, X3, X4, X5, X6, X7) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_int", + "signature": "int __tact_dict_get_uint_int(cell d, int kl, int k, int vl)", }, { "code": { - "code": "8 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_8", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> (X0, X1, X2, X3, X4, X5, X6, X7) __tact_tuple_destroy_8(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_int", + "signature": "(int, int, int) __tact_dict_min_uint_int(cell d, int kl, int vl)", }, { "code": { - "code": "9 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_9", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> tuple __tact_tuple_create_9((X0, X1, X2, X3, X4, X5, X6, X7, X8) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_int", + "signature": "(int, int, int) __tact_dict_next_uint_int(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "9 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_9", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8) __tact_tuple_destroy_9(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_int", + "signature": "(cell, ()) __tact_dict_set_uint_int(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "10 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_10", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> tuple __tact_tuple_create_10((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_uint", + "signature": "int __tact_dict_get_uint_uint(cell d, int kl, int k, int vl)", }, { "code": { - "code": "10 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_10", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __tact_tuple_destroy_10(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_uint", + "signature": "(int, int, int) __tact_dict_min_uint_uint(cell d, int kl, int vl)", }, { "code": { - "code": "11 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_11", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> tuple __tact_tuple_create_11((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_uint", + "signature": "(int, int, int) __tact_dict_next_uint_uint(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "11 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_11", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __tact_tuple_destroy_11(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_uint", + "signature": "(cell, ()) __tact_dict_set_uint_uint(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "12 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get_ref?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_12", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> tuple __tact_tuple_create_12((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_cell", + "signature": "cell __tact_dict_get_uint_cell(cell d, int kl, int k)", }, { "code": { - "code": "12 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min_ref?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_12", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __tact_tuple_destroy_12(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_cell", + "signature": "(int, cell, int) __tact_dict_min_uint_cell(cell d, int kl)", }, { "code": { - "code": "13 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_13", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> tuple __tact_tuple_create_13((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_cell", + "signature": "(int, cell, int) __tact_dict_next_uint_cell(cell d, int kl, int pivot)", }, { "code": { - "code": "13 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_ref(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_13", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __tact_tuple_destroy_13(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_cell", + "signature": "(cell, ()) __tact_dict_set_uint_cell(cell d, int kl, int k, cell v)", }, { "code": { - "code": "14 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_14", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> tuple __tact_tuple_create_14((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_int_slice", + "signature": "slice __tact_dict_get_int_slice(cell d, int kl, int k)", }, { "code": { - "code": "14 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_14", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __tact_tuple_destroy_14(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_int_slice", + "signature": "(int, slice, int) __tact_dict_min_int_slice(cell d, int kl)", }, { "code": { - "code": "15 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_15", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> tuple __tact_tuple_create_15((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_int_slice", + "signature": "(int, slice, int) __tact_dict_next_int_slice(cell d, int kl, int pivot)", }, { "code": { - "code": "15 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_15", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __tact_tuple_destroy_15(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_int_slice", + "signature": "(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v)", }, { "code": { - "code": "return tpush(tpush(empty_tuple(), b), null());", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, @@ -5906,66 +5989,74 @@ return data;", "flags": Set { "inline", }, - "name": "__tact_string_builder_start", - "signature": "tuple __tact_string_builder_start(builder b)", + "name": "__tact_dict_get_int_int", + "signature": "int __tact_dict_get_int_int(cell d, int kl, int k, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 32));", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_comment", - "signature": "tuple __tact_string_builder_start_comment()", + "name": "__tact_dict_min_int_int", + "signature": "(int, int, int) __tact_dict_min_int_int(cell d, int kl, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 8));", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_tail_string", - "signature": "tuple __tact_string_builder_start_tail_string()", + "name": "__tact_dict_next_int_int", + "signature": "(int, int, int) __tact_dict_next_int_int(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell());", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_string", - "signature": "tuple __tact_string_builder_start_string()", + "name": "__tact_dict_set_int_int", + "signature": "(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "(builder b, tuple tail) = uncons(builders); -cell c = b.end_cell(); -while(~ null?(tail)) { - (b, tail) = uncons(tail); - c = b.store_ref(c).end_cell(); -} -return c;", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, @@ -5974,203 +6065,112 @@ return c;", "flags": Set { "inline", }, - "name": "__tact_string_builder_end", - "signature": "cell __tact_string_builder_end(tuple builders)", + "name": "__tact_dict_get_int_uint", + "signature": "int __tact_dict_get_int_uint(cell d, int kl, int k, int vl)", }, { "code": { - "code": "return __tact_string_builder_end(builders).begin_parse();", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_end", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_end_slice", - "signature": "slice __tact_string_builder_end_slice(tuple builders)", + "name": "__tact_dict_min_int_uint", + "signature": "(int, int, int) __tact_dict_min_int_uint(cell d, int kl, int vl)", }, { "code": { - "code": "int sliceRefs = slice_refs(sc); -int sliceBits = slice_bits(sc); - -while((sliceBits > 0) | (sliceRefs > 0)) { - - ;; Load the current builder - (builder b, tuple tail) = uncons(builders); - int remBytes = 127 - (builder_bits(b) / 8); - int exBytes = sliceBits / 8; - - ;; Append bits - int amount = min(remBytes, exBytes); - if (amount > 0) { - slice read = sc~load_bits(amount * 8); - b = b.store_slice(read); - } - - ;; Update builders - builders = cons(b, tail); - - ;; Check if we need to add a new cell and continue - if (exBytes - amount > 0) { - var bb = begin_cell(); - builders = cons(bb, builders); - sliceBits = (exBytes - amount) * 8; - } elseif (sliceRefs > 0) { - sc = sc~load_ref().begin_parse(); - sliceRefs = slice_refs(sc); - sliceBits = slice_bits(sc); - } else { - sliceBits = 0; - sliceRefs = 0; - } -} - -return ((builders), ());", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_string_builder_append", - "signature": "((tuple), ()) __tact_string_builder_append(tuple builders, slice sc)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_int_uint", + "signature": "(int, int, int) __tact_dict_next_int_uint(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "builders~__tact_string_builder_append(sc); -return builders;", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_append", + "depends": Set {}, + "flags": Set { + "inline", }, - "flags": Set {}, - "name": "__tact_string_builder_append_not_mut", - "signature": "(tuple) __tact_string_builder_append_not_mut(tuple builders, slice sc)", - }, - { - "code": { - "code": "var b = begin_cell(); -if (src < 0) { - b = b.store_uint(45, 8); - src = - src; -} - -if (src < 1000000000000000000000000000000) { - int len = 0; - int value = 0; - int mult = 1; - do { - (src, int res) = src.divmod(10); - value = value + (res + 48) * mult; - mult = mult * 256; - len = len + 1; - } until (src == 0); - - b = b.store_uint(value, len * 8); -} else { - tuple t = empty_tuple(); - int len = 0; - do { - int digit = src % 10; - t~tpush(digit); - len = len + 1; - src = src / 10; - } until (src == 0); - - int c = len - 1; - repeat(len) { - int v = t.at(c); - b = b.store_uint(v + 48, 8); - c = c - 1; - } -} -return b.end_cell().begin_parse();", + "name": "__tact_dict_set_int_uint", + "signature": "(cell, ()) __tact_dict_set_int_uint(cell d, int kl, int k, int v, int vl)", + }, + { + "code": { + "code": "var (r, ok) = idict_get_ref?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_int_to_string", - "signature": "slice __tact_int_to_string(int src)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_int_cell", + "signature": "cell __tact_dict_get_int_cell(cell d, int kl, int k)", }, { "code": { - "code": "throw_if(134, (digits <= 0) | (digits > 77)); -builder b = begin_cell(); - -if (src < 0) { - b = b.store_uint(45, 8); - src = - src; -} - -;; Process rem part -int skip = true; -int len = 0; -int rem = 0; -tuple t = empty_tuple(); -repeat(digits) { - (src, rem) = src.divmod(10); - if ( ~ ( skip & ( rem == 0 ) ) ) { - skip = false; - t~tpush(rem + 48); - len = len + 1; - } -} - -;; Process dot -if (~ skip) { - t~tpush(46); - len = len + 1; -} - -;; Main -do { - (src, rem) = src.divmod(10); - t~tpush(rem + 48); - len = len + 1; -} until (src == 0); - -;; Assemble -int c = len - 1; -repeat(len) { - int v = t.at(c); - b = b.store_uint(v, 8); - c = c - 1; -} - -;; Result -return b.end_cell().begin_parse();", + "code": "var (key, value, flag) = idict_get_min_ref?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_float_to_string", - "signature": "slice __tact_float_to_string(int src, int digits)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_int_cell", + "signature": "(int, cell, int) __tact_dict_min_int_cell(cell d, int kl)", }, { "code": { - "code": "throw_unless(5, num > 0); -throw_unless(5, base > 1); -if (num < base) { - return 0; -} -int result = 0; -while (num >= base) { - num /= base; - result += 1; -} -return result;", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, @@ -6179,17 +6179,17 @@ return result;", "flags": Set { "inline", }, - "name": "__tact_log", - "signature": "int __tact_log(int num, int base)", + "name": "__tact_dict_next_int_cell", + "signature": "(int, cell, int) __tact_dict_next_int_cell(cell d, int kl, int pivot)", }, { "code": { - "code": "throw_unless(5, exp >= 0); -int result = 1; -repeat (exp) { - result *= base; -} -return result;", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_ref(d, kl, k, v), ()); +}", "kind": "generic", }, "comment": null, @@ -6198,23 +6198,25 @@ return result;", "flags": Set { "inline", }, - "name": "__tact_pow", - "signature": "int __tact_pow(int base, int exp)", + "name": "__tact_dict_set_int_cell", + "signature": "(cell, ()) __tact_dict_set_int_cell(cell d, int kl, int k, cell v)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); + "code": "var (r, ok) = __tact_dict_get(d, kl, k); return ok;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_dict_exists_int", - "signature": "int __tact_dict_exists_int(cell d, int kl, int k)", + "name": "__tact_dict_exists_slice", + "signature": "int __tact_dict_exists_slice(cell d, int kl, slice k)", }, { "code": { @@ -6233,20 +6235,18 @@ return ok;", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); + "code": "var (r, ok) = idict_get?(d, kl, k); return ok;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_dict_exists_slice", - "signature": "int __tact_dict_exists_slice(cell d, int kl, slice k)", + "name": "__tact_dict_exists_int", + "signature": "int __tact_dict_exists_int(cell d, int kl, int k)", }, { "code": { @@ -7760,12 +7760,7 @@ return __tact_base64_encode(user_friendly_address_with_checksum);", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", + "code": "return equal_slices_bits(a, b);", "kind": "generic", }, "comment": null, @@ -7774,17 +7769,12 @@ return __tact_base64_encode(user_friendly_address_with_checksum);", "flags": Set { "inline", }, - "name": "__tact_dict_set_int_int", - "signature": "(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl)", + "name": "__tact_slice_eq_bits", + "signature": "int __tact_slice_eq_bits(slice a, slice b)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", + "code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));", "kind": "generic", }, "comment": null, @@ -7793,17 +7783,14 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_int", - "signature": "int __tact_dict_get_int_int(cell d, int kl, int k, int vl)", + "name": "__tact_slice_eq_bits_nullable_one", + "signature": "int __tact_slice_eq_bits_nullable_one(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -7812,17 +7799,41 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_int", - "signature": "(int, int, int) __tact_dict_min_int_int(cell d, int kl, int vl)", + "name": "__tact_slice_eq_bits_nullable", + "signature": "int __tact_slice_eq_bits_nullable(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "(slice key, slice value, int flag) = __tact_dict_min(a, kl); +while (flag) { + (slice value_b, int flag_b) = b~__tact_dict_delete_get(kl, key); + ifnot (flag_b) { + return 0; + } + ifnot (value.slice_hash() == value_b.slice_hash()) { + return 0; + } + (key, value, flag) = __tact_dict_next(a, kl, key); +} +return null?(b);", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set { + "__tact_dict_min", + "__tact_dict_delete_get", + "__tact_dict_next", + }, + "flags": Set { + "inline", + }, + "name": "__tact_dict_eq", + "signature": "int __tact_dict_eq(cell a, cell b, int kl)", + }, + { + "code": { + "code": "return (null?(a)) ? (false) : (a == b);", "kind": "generic", }, "comment": null, @@ -7831,17 +7842,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_int_int", - "signature": "(int, int, int) __tact_dict_next_int_int(cell d, int kl, int pivot, int vl)", + "name": "__tact_int_eq_nullable_one", + "signature": "int __tact_int_eq_nullable_one(int a, int b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", + "code": "return (null?(a)) ? (true) : (a != b);", "kind": "generic", }, "comment": null, @@ -7850,17 +7856,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_int_uint", - "signature": "(cell, ()) __tact_dict_set_int_uint(cell d, int kl, int k, int v, int vl)", + "name": "__tact_int_neq_nullable_one", + "signature": "int __tact_int_neq_nullable_one(int a, int b)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a == b ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -7869,17 +7872,28 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_uint", - "signature": "int __tact_dict_get_int_uint(cell d, int kl, int k, int vl)", + "name": "__tact_int_eq_nullable", + "signature": "int __tact_int_eq_nullable(int a, int b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a != b ) : ( true ) );", + "kind": "generic", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set { + "inline", + }, + "name": "__tact_int_neq_nullable", + "signature": "int __tact_int_neq_nullable(int a, int b)", + }, + { + "code": { + "code": "return (a.cell_hash() == b.cell_hash());", "kind": "generic", }, "comment": null, @@ -7888,17 +7902,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_uint", - "signature": "(int, int, int) __tact_dict_min_int_uint(cell d, int kl, int vl)", + "name": "__tact_cell_eq", + "signature": "int __tact_cell_eq(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (a.cell_hash() != b.cell_hash());", "kind": "generic", }, "comment": null, @@ -7907,17 +7916,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_int_uint", - "signature": "(int, int, int) __tact_dict_next_int_uint(cell d, int kl, int pivot, int vl)", + "name": "__tact_cell_neq", + "signature": "int __tact_cell_neq(cell a, cell b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", + "code": "return (null?(a)) ? (false) : (a.cell_hash() == b.cell_hash());", "kind": "generic", }, "comment": null, @@ -7926,17 +7930,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_uint_int", - "signature": "(cell, ()) __tact_dict_set_uint_int(cell d, int kl, int k, int v, int vl)", + "name": "__tact_cell_eq_nullable_one", + "signature": "int __tact_cell_eq_nullable_one(cell a, cell b)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", + "code": "return (null?(a)) ? (true) : (a.cell_hash() != b.cell_hash());", "kind": "generic", }, "comment": null, @@ -7945,17 +7944,14 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_int", - "signature": "int __tact_dict_get_uint_int(cell d, int kl, int k, int vl)", + "name": "__tact_cell_neq_nullable_one", + "signature": "int __tact_cell_neq_nullable_one(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() == b.cell_hash() ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -7964,17 +7960,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_uint_int", - "signature": "(int, int, int) __tact_dict_min_uint_int(cell d, int kl, int vl)", + "name": "__tact_cell_eq_nullable", + "signature": "int __tact_cell_eq_nullable(cell a, cell b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() != b.cell_hash() ) : ( true ) );", "kind": "generic", }, "comment": null, @@ -7983,17 +7976,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_uint_int", - "signature": "(int, int, int) __tact_dict_next_uint_int(cell d, int kl, int pivot, int vl)", + "name": "__tact_cell_neq_nullable", + "signature": "int __tact_cell_neq_nullable(cell a, cell b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", + "code": "return (a.slice_hash() == b.slice_hash());", "kind": "generic", }, "comment": null, @@ -8002,17 +7990,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_uint_uint", - "signature": "(cell, ()) __tact_dict_set_uint_uint(cell d, int kl, int k, int v, int vl)", + "name": "__tact_slice_eq", + "signature": "int __tact_slice_eq(slice a, slice b)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", + "code": "return (a.slice_hash() != b.slice_hash());", "kind": "generic", }, "comment": null, @@ -8021,17 +8004,12 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_uint", - "signature": "int __tact_dict_get_uint_uint(cell d, int kl, int k, int vl)", + "name": "__tact_slice_neq", + "signature": "int __tact_slice_neq(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (null?(a)) ? (false) : (a.slice_hash() == b.slice_hash());", "kind": "generic", }, "comment": null, @@ -8040,17 +8018,12 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_uint_uint", - "signature": "(int, int, int) __tact_dict_min_uint_uint(cell d, int kl, int vl)", + "name": "__tact_slice_eq_nullable_one", + "signature": "int __tact_slice_eq_nullable_one(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", + "code": "return (null?(a)) ? (true) : (a.slice_hash() != b.slice_hash());", "kind": "generic", }, "comment": null, @@ -8059,17 +8032,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_uint_uint", - "signature": "(int, int, int) __tact_dict_next_uint_uint(cell d, int kl, int pivot, int vl)", + "name": "__tact_slice_neq_nullable_one", + "signature": "int __tact_slice_neq_nullable_one(slice a, slice b)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set_ref(d, kl, k, v), ()); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() == b.slice_hash() ) : ( false ) );", "kind": "generic", }, "comment": null, @@ -8078,17 +8048,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_set_int_cell", - "signature": "(cell, ()) __tact_dict_set_int_cell(cell d, int kl, int k, cell v)", + "name": "__tact_slice_eq_nullable", + "signature": "int __tact_slice_eq_nullable(slice a, slice b)", }, { "code": { - "code": "var (r, ok) = idict_get_ref?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", + "code": "var a_is_null = null?(a); +var b_is_null = null?(b); +return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() != b.slice_hash() ) : ( true ) );", "kind": "generic", }, "comment": null, @@ -8097,17 +8064,12 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_int_cell", - "signature": "cell __tact_dict_get_int_cell(cell d, int kl, int k)", + "name": "__tact_slice_neq_nullable", + "signature": "int __tact_slice_neq_nullable(slice a, slice b)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min_ref?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", + "code": "return udict_set_ref(dict, 16, id, code);", "kind": "generic", }, "comment": null, @@ -8116,17 +8078,14 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_min_int_cell", - "signature": "(int, cell, int) __tact_dict_min_int_cell(cell d, int kl)", + "name": "__tact_dict_set_code", + "signature": "cell __tact_dict_set_code(cell dict, int id, cell code)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", + "code": "var (data, ok) = udict_get_ref?(dict, 16, id); +throw_unless(135, ok); +return data;", "kind": "generic", }, "comment": null, @@ -8135,36 +8094,25 @@ if (flag) { "flags": Set { "inline", }, - "name": "__tact_dict_next_int_cell", - "signature": "(int, cell, int) __tact_dict_next_int_cell(cell d, int kl, int pivot)", + "name": "__tact_dict_get_code", + "signature": "cell __tact_dict_get_code(cell dict, int id)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set_ref(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "NIL", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_uint_cell", - "signature": "(cell, ()) __tact_dict_set_uint_cell(cell d, int kl, int k, cell v)", + "flags": Set {}, + "name": "__tact_tuple_create_0", + "signature": "tuple __tact_tuple_create_0()", }, { "code": { - "code": "var (r, ok) = udict_get_ref?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", + "code": "return ();", "kind": "generic", }, "comment": null, @@ -8173,564 +8121,402 @@ if (ok) { "flags": Set { "inline", }, - "name": "__tact_dict_get_uint_cell", - "signature": "cell __tact_dict_get_uint_cell(cell d, int kl, int k)", + "name": "__tact_tuple_destroy_0", + "signature": "() __tact_tuple_destroy_0()", }, { "code": { - "code": "var (key, value, flag) = udict_get_min_ref?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "1 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_uint_cell", - "signature": "(int, cell, int) __tact_dict_min_uint_cell(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_create_1", + "signature": "forall X0 -> tuple __tact_tuple_create_1((X0) v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "1 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_uint_cell", - "signature": "(int, cell, int) __tact_dict_next_uint_cell(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_destroy_1", + "signature": "forall X0 -> (X0) __tact_tuple_destroy_1(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); -} else { - return (idict_set(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "2 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_int_slice", - "signature": "(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v)", + "flags": Set {}, + "name": "__tact_tuple_create_2", + "signature": "forall X0, X1 -> tuple __tact_tuple_create_2((X0, X1) v)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "2 UNTUPLE", + "kind": "asm", + "shuffle": "", + }, + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_2", + "signature": "forall X0, X1 -> (X0, X1) __tact_tuple_destroy_2(tuple v)", + }, + { + "code": { + "code": "3 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_int_slice", - "signature": "slice __tact_dict_get_int_slice(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_create_3", + "signature": "forall X0, X1, X2 -> tuple __tact_tuple_create_3((X0, X1, X2) v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_min?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "3 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_int_slice", - "signature": "(int, slice, int) __tact_dict_min_int_slice(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_destroy_3", + "signature": "forall X0, X1, X2 -> (X0, X1, X2) __tact_tuple_destroy_3(tuple v)", }, { "code": { - "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "4 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_int_slice", - "signature": "(int, slice, int) __tact_dict_next_int_slice(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_create_4", + "signature": "forall X0, X1, X2, X3 -> tuple __tact_tuple_create_4((X0, X1, X2, X3) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); -} else { - return (udict_set(d, kl, k, v), ()); -}", - "kind": "generic", + "code": "4 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_uint_slice", - "signature": "(cell, ()) __tact_dict_set_uint_slice(cell d, int kl, int k, slice v)", + "flags": Set {}, + "name": "__tact_tuple_destroy_4", + "signature": "forall X0, X1, X2, X3 -> (X0, X1, X2, X3) __tact_tuple_destroy_4(tuple v)", }, { "code": { - "code": "var (r, ok) = udict_get?(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "5 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_uint_slice", - "signature": "slice __tact_dict_get_uint_slice(cell d, int kl, int k)", + "flags": Set {}, + "name": "__tact_tuple_create_5", + "signature": "forall X0, X1, X2, X3, X4 -> tuple __tact_tuple_create_5((X0, X1, X2, X3, X4) v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_min?(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "5 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_uint_slice", - "signature": "(int, slice, int) __tact_dict_min_uint_slice(cell d, int kl)", + "flags": Set {}, + "name": "__tact_tuple_destroy_5", + "signature": "forall X0, X1, X2, X3, X4 -> (X0, X1, X2, X3, X4) __tact_tuple_destroy_5(tuple v)", }, { "code": { - "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "6 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_uint_slice", - "signature": "(int, slice, int) __tact_dict_next_uint_slice(cell d, int kl, int pivot)", + "flags": Set {}, + "name": "__tact_tuple_create_6", + "signature": "forall X0, X1, X2, X3, X4, X5 -> tuple __tact_tuple_create_6((X0, X1, X2, X3, X4, X5) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); -}", - "kind": "generic", + "code": "6 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_int", - "signature": "(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_6", + "signature": "forall X0, X1, X2, X3, X4, X5 -> (X0, X1, X2, X3, X4, X5) __tact_tuple_destroy_6(tuple v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r~load_int(vl); -} else { - return null(); -}", - "kind": "generic", + "code": "7 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_int", - "signature": "int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_7", + "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> tuple __tact_tuple_create_7((X0, X1, X2, X3, X4, X5, X6) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "7 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_int", - "signature": "(slice, int, int) __tact_dict_min_slice_int(cell d, int kl, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_7", + "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> (X0, X1, X2, X3, X4, X5, X6) __tact_tuple_destroy_7(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_int(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "8 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_int", - "signature": "(slice, int, int) __tact_dict_next_slice_int(cell d, int kl, slice pivot, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_8", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> tuple __tact_tuple_create_8((X0, X1, X2, X3, X4, X5, X6, X7) v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); -}", - "kind": "generic", + "code": "8 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_uint", - "signature": "(cell, ()) __tact_dict_set_slice_uint(cell d, int kl, slice k, int v, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_8", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> (X0, X1, X2, X3, X4, X5, X6, X7) __tact_tuple_destroy_8(tuple v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r~load_uint(vl); -} else { - return null(); -}", - "kind": "generic", + "code": "9 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, - "flags": Set { - "inline", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_9", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> tuple __tact_tuple_create_9((X0, X1, X2, X3, X4, X5, X6, X7, X8) v)", + }, + { + "code": { + "code": "9 UNTUPLE", + "kind": "asm", + "shuffle": "", }, - "name": "__tact_dict_get_slice_uint", - "signature": "int __tact_dict_get_slice_uint(cell d, int kl, slice k, int vl)", + "comment": null, + "context": "stdlib", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_9", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8) __tact_tuple_destroy_9(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "10 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_uint", - "signature": "(slice, int, int) __tact_dict_min_slice_uint(cell d, int kl, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_10", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> tuple __tact_tuple_create_10((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_uint(vl), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "10 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_uint", - "signature": "(slice, int, int) __tact_dict_next_slice_uint(cell d, int kl, slice pivot, int vl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_10", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __tact_tuple_destroy_10(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return __tact_dict_set_ref(d, kl, k, v); -}", - "kind": "generic", + "code": "11 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - "__tact_dict_set_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_cell", - "signature": "(cell, ()) __tact_dict_set_slice_cell(cell d, int kl, slice k, cell v)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_11", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> tuple __tact_tuple_create_11((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get_ref(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "11 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_cell", - "signature": "cell __tact_dict_get_slice_cell(cell d, int kl, slice k)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_11", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __tact_tuple_destroy_11(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min_ref(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "12 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min_ref", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_cell", - "signature": "(slice, cell, int) __tact_dict_min_slice_cell(cell d, int kl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_12", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> tuple __tact_tuple_create_12((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); -if (flag) { - return (key, value~load_ref(), flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "12 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_cell", - "signature": "(slice, cell, int) __tact_dict_next_slice_cell(cell d, int kl, slice pivot)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_12", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __tact_tuple_destroy_12(tuple v)", }, { "code": { - "code": "if (null?(v)) { - var (r, ok) = __tact_dict_delete(d, kl, k); - return (r, ()); -} else { - return (dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ()); -}", - "kind": "generic", + "code": "13 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_delete", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_set_slice_slice", - "signature": "(cell, ()) __tact_dict_set_slice_slice(cell d, int kl, slice k, slice v)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_13", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> tuple __tact_tuple_create_13((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) v)", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); -if (ok) { - return r; -} else { - return null(); -}", - "kind": "generic", + "code": "13 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_get_slice_slice", - "signature": "slice __tact_dict_get_slice_slice(cell d, int kl, slice k)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_13", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __tact_tuple_destroy_13(tuple v)", }, { "code": { - "code": "var (key, value, flag) = __tact_dict_min(d, kl); -if (flag) { - return (key, value, flag); -} else { - return (null(), null(), flag); -}", - "kind": "generic", + "code": "14 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_min", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_min_slice_slice", - "signature": "(slice, slice, int) __tact_dict_min_slice_slice(cell d, int kl)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_create_14", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> tuple __tact_tuple_create_14((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) v)", }, { "code": { - "code": "return __tact_dict_next(d, kl, pivot);", - "kind": "generic", + "code": "14 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_next", - }, - "flags": Set { - "inline", - }, - "name": "__tact_dict_next_slice_slice", - "signature": "(slice, slice, int) __tact_dict_next_slice_slice(cell d, int kl, slice pivot)", + "depends": Set {}, + "flags": Set {}, + "name": "__tact_tuple_destroy_14", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __tact_tuple_destroy_14(tuple v)", }, { "code": { - "code": "return equal_slices_bits(a, b);", - "kind": "generic", + "code": "15 TUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_slice_eq_bits", - "signature": "int __tact_slice_eq_bits(slice a, slice b)", + "flags": Set {}, + "name": "__tact_tuple_create_15", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> tuple __tact_tuple_create_15((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) v)", }, { "code": { - "code": "return (null?(a)) ? (false) : (equal_slices_bits(a, b));", - "kind": "generic", + "code": "15 UNTUPLE", + "kind": "asm", + "shuffle": "", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_slice_eq_bits_nullable_one", - "signature": "int __tact_slice_eq_bits_nullable_one(slice a, slice b)", + "flags": Set {}, + "name": "__tact_tuple_destroy_15", + "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __tact_tuple_destroy_15(tuple v)", }, { - "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( equal_slices_bits(a, b) ) : ( false ) );", + "code": { + "code": "return tpush(tpush(empty_tuple(), b), null());", "kind": "generic", }, "comment": null, @@ -8739,71 +8525,66 @@ return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nul "flags": Set { "inline", }, - "name": "__tact_slice_eq_bits_nullable", - "signature": "int __tact_slice_eq_bits_nullable(slice a, slice b)", + "name": "__tact_string_builder_start", + "signature": "tuple __tact_string_builder_start(builder b)", }, { "code": { - "code": "(slice key, slice value, int flag) = __tact_dict_min(a, kl); -while (flag) { - (slice value_b, int flag_b) = b~__tact_dict_delete_get(kl, key); - ifnot (flag_b) { - return 0; - } - ifnot (value.slice_hash() == value_b.slice_hash()) { - return 0; - } - (key, value, flag) = __tact_dict_next(a, kl, key); -} -return null?(b);", + "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 32));", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set { - "__tact_dict_min", - "__tact_dict_delete_get", - "__tact_dict_next", + "__tact_string_builder_start", }, "flags": Set { "inline", }, - "name": "__tact_dict_eq", - "signature": "int __tact_dict_eq(cell a, cell b, int kl)", + "name": "__tact_string_builder_start_comment", + "signature": "tuple __tact_string_builder_start_comment()", }, { "code": { - "code": "return (null?(a)) ? (false) : (a == b);", + "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 8));", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_start", + }, "flags": Set { "inline", }, - "name": "__tact_int_eq_nullable_one", - "signature": "int __tact_int_eq_nullable_one(int a, int b)", + "name": "__tact_string_builder_start_tail_string", + "signature": "tuple __tact_string_builder_start_tail_string()", }, { "code": { - "code": "return (null?(a)) ? (true) : (a != b);", + "code": "return __tact_string_builder_start(begin_cell());", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_start", + }, "flags": Set { "inline", }, - "name": "__tact_int_neq_nullable_one", - "signature": "int __tact_int_neq_nullable_one(int a, int b)", + "name": "__tact_string_builder_start_string", + "signature": "tuple __tact_string_builder_start_string()", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a == b ) : ( false ) );", + "code": "(builder b, tuple tail) = uncons(builders); +cell c = b.end_cell(); +while(~ null?(tail)) { + (b, tail) = uncons(tail); + c = b.store_ref(c).end_cell(); +} +return c;", "kind": "generic", }, "comment": null, @@ -8812,86 +8593,203 @@ return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nul "flags": Set { "inline", }, - "name": "__tact_int_eq_nullable", - "signature": "int __tact_int_eq_nullable(int a, int b)", + "name": "__tact_string_builder_end", + "signature": "cell __tact_string_builder_end(tuple builders)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a != b ) : ( true ) );", + "code": "return __tact_string_builder_end(builders).begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_string_builder_end", + }, "flags": Set { "inline", }, - "name": "__tact_int_neq_nullable", - "signature": "int __tact_int_neq_nullable(int a, int b)", + "name": "__tact_string_builder_end_slice", + "signature": "slice __tact_string_builder_end_slice(tuple builders)", }, { "code": { - "code": "return (a.cell_hash() == b.cell_hash());", + "code": "int sliceRefs = slice_refs(sc); +int sliceBits = slice_bits(sc); + +while((sliceBits > 0) | (sliceRefs > 0)) { + + ;; Load the current builder + (builder b, tuple tail) = uncons(builders); + int remBytes = 127 - (builder_bits(b) / 8); + int exBytes = sliceBits / 8; + + ;; Append bits + int amount = min(remBytes, exBytes); + if (amount > 0) { + slice read = sc~load_bits(amount * 8); + b = b.store_slice(read); + } + + ;; Update builders + builders = cons(b, tail); + + ;; Check if we need to add a new cell and continue + if (exBytes - amount > 0) { + var bb = begin_cell(); + builders = cons(bb, builders); + sliceBits = (exBytes - amount) * 8; + } elseif (sliceRefs > 0) { + sc = sc~load_ref().begin_parse(); + sliceRefs = slice_refs(sc); + sliceBits = slice_bits(sc); + } else { + sliceBits = 0; + sliceRefs = 0; + } +} + +return ((builders), ());", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_cell_eq", - "signature": "int __tact_cell_eq(cell a, cell b)", + "flags": Set {}, + "name": "__tact_string_builder_append", + "signature": "((tuple), ()) __tact_string_builder_append(tuple builders, slice sc)", }, { "code": { - "code": "return (a.cell_hash() != b.cell_hash());", + "code": "builders~__tact_string_builder_append(sc); +return builders;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set { - "inline", + "depends": Set { + "__tact_string_builder_append", }, - "name": "__tact_cell_neq", - "signature": "int __tact_cell_neq(cell a, cell b)", + "flags": Set {}, + "name": "__tact_string_builder_append_not_mut", + "signature": "(tuple) __tact_string_builder_append_not_mut(tuple builders, slice sc)", }, { "code": { - "code": "return (null?(a)) ? (false) : (a.cell_hash() == b.cell_hash());", + "code": "var b = begin_cell(); +if (src < 0) { + b = b.store_uint(45, 8); + src = - src; +} + +if (src < 1000000000000000000000000000000) { + int len = 0; + int value = 0; + int mult = 1; + do { + (src, int res) = src.divmod(10); + value = value + (res + 48) * mult; + mult = mult * 256; + len = len + 1; + } until (src == 0); + + b = b.store_uint(value, len * 8); +} else { + tuple t = empty_tuple(); + int len = 0; + do { + int digit = src % 10; + t~tpush(digit); + len = len + 1; + src = src / 10; + } until (src == 0); + + int c = len - 1; + repeat(len) { + int v = t.at(c); + b = b.store_uint(v + 48, 8); + c = c - 1; + } +} +return b.end_cell().begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_cell_eq_nullable_one", - "signature": "int __tact_cell_eq_nullable_one(cell a, cell b)", + "flags": Set {}, + "name": "__tact_int_to_string", + "signature": "slice __tact_int_to_string(int src)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a.cell_hash() != b.cell_hash());", + "code": "throw_if(134, (digits <= 0) | (digits > 77)); +builder b = begin_cell(); + +if (src < 0) { + b = b.store_uint(45, 8); + src = - src; +} + +;; Process rem part +int skip = true; +int len = 0; +int rem = 0; +tuple t = empty_tuple(); +repeat(digits) { + (src, rem) = src.divmod(10); + if ( ~ ( skip & ( rem == 0 ) ) ) { + skip = false; + t~tpush(rem + 48); + len = len + 1; + } +} + +;; Process dot +if (~ skip) { + t~tpush(46); + len = len + 1; +} + +;; Main +do { + (src, rem) = src.divmod(10); + t~tpush(rem + 48); + len = len + 1; +} until (src == 0); + +;; Assemble +int c = len - 1; +repeat(len) { + int v = t.at(c); + b = b.store_uint(v, 8); + c = c - 1; +} + +;; Result +return b.end_cell().begin_parse();", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set { - "inline", - }, - "name": "__tact_cell_neq_nullable_one", - "signature": "int __tact_cell_neq_nullable_one(cell a, cell b)", + "flags": Set {}, + "name": "__tact_float_to_string", + "signature": "slice __tact_float_to_string(int src, int digits)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() == b.cell_hash() ) : ( false ) );", + "code": "throw_unless(5, num > 0); +throw_unless(5, base > 1); +if (num < base) { + return 0; +} +int result = 0; +while (num >= base) { + num /= base; + result += 1; +} +return result;", "kind": "generic", }, "comment": null, @@ -8900,14 +8798,17 @@ return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nul "flags": Set { "inline", }, - "name": "__tact_cell_eq_nullable", - "signature": "int __tact_cell_eq_nullable(cell a, cell b)", + "name": "__tact_log", + "signature": "int __tact_log(int num, int base)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.cell_hash() != b.cell_hash() ) : ( true ) );", + "code": "throw_unless(5, exp >= 0); +int result = 1; +repeat (exp) { + result *= base; +} +return result;", "kind": "generic", }, "comment": null, @@ -8916,547 +8817,729 @@ return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_nu "flags": Set { "inline", }, - "name": "__tact_cell_neq_nullable", - "signature": "int __tact_cell_neq_nullable(cell a, cell b)", + "name": "__tact_pow", + "signature": "int __tact_pow(int base, int exp)", }, { "code": { - "code": "return (a.slice_hash() == b.slice_hash());", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq", - "signature": "int __tact_slice_eq(slice a, slice b)", + "name": "__tact_dict_get_slice_slice", + "signature": "slice __tact_dict_get_slice_slice(cell d, int kl, slice k)", }, { "code": { - "code": "return (a.slice_hash() != b.slice_hash());", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq", - "signature": "int __tact_slice_neq(slice a, slice b)", + "name": "__tact_dict_min_slice_slice", + "signature": "(slice, slice, int) __tact_dict_min_slice_slice(cell d, int kl)", }, { "code": { - "code": "return (null?(a)) ? (false) : (a.slice_hash() == b.slice_hash());", + "code": "return __tact_dict_next(d, kl, pivot);", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_nullable_one", - "signature": "int __tact_slice_eq_nullable_one(slice a, slice b)", + "name": "__tact_dict_next_slice_slice", + "signature": "(slice, slice, int) __tact_dict_next_slice_slice(cell d, int kl, slice pivot)", }, { "code": { - "code": "return (null?(a)) ? (true) : (a.slice_hash() != b.slice_hash());", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq_nullable_one", - "signature": "int __tact_slice_neq_nullable_one(slice a, slice b)", + "name": "__tact_dict_set_slice_slice", + "signature": "(cell, ()) __tact_dict_set_slice_slice(cell d, int kl, slice k, slice v)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( true ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() == b.slice_hash() ) : ( false ) );", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_slice_eq_nullable", - "signature": "int __tact_slice_eq_nullable(slice a, slice b)", + "name": "__tact_dict_get_slice_int", + "signature": "int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl)", }, { "code": { - "code": "var a_is_null = null?(a); -var b_is_null = null?(b); -return ( a_is_null & b_is_null ) ? ( false ) : ( ( ( ~ a_is_null ) & ( ~ b_is_null ) ) ? ( a.slice_hash() != b.slice_hash() ) : ( true ) );", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_slice_neq_nullable", - "signature": "int __tact_slice_neq_nullable(slice a, slice b)", + "name": "__tact_dict_min_slice_int", + "signature": "(slice, int, int) __tact_dict_min_slice_int(cell d, int kl, int vl)", }, { "code": { - "code": "return udict_set_ref(dict, 16, id, code);", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_next", + }, "flags": Set { "inline", }, - "name": "__tact_dict_set_code", - "signature": "cell __tact_dict_set_code(cell dict, int id, cell code)", + "name": "__tact_dict_next_slice_int", + "signature": "(slice, int, int) __tact_dict_next_slice_int(cell d, int kl, slice pivot, int vl)", }, { "code": { - "code": "var (data, ok) = udict_get_ref?(dict, 16, id); -throw_unless(135, ok); -return data;", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_delete", + }, "flags": Set { "inline", }, - "name": "__tact_dict_get_code", - "signature": "cell __tact_dict_get_code(cell dict, int id)", + "name": "__tact_dict_set_slice_int", + "signature": "(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl)", }, { "code": { - "code": "NIL", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = __tact_dict_get(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_0", - "signature": "tuple __tact_tuple_create_0()", + "depends": Set { + "__tact_dict_get", + }, + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_slice_uint", + "signature": "int __tact_dict_get_slice_uint(cell d, int kl, slice k, int vl)", }, { "code": { - "code": "return ();", + "code": "var (key, value, flag) = __tact_dict_min(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_min", + }, "flags": Set { "inline", }, - "name": "__tact_tuple_destroy_0", - "signature": "() __tact_tuple_destroy_0()", + "name": "__tact_dict_min_slice_uint", + "signature": "(slice, int, int) __tact_dict_min_slice_uint(cell d, int kl, int vl)", }, { "code": { - "code": "1 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_1", - "signature": "forall X0 -> tuple __tact_tuple_create_1((X0) v)", - }, - { - "code": { - "code": "1 UNTUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_next", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_1", - "signature": "forall X0 -> (X0) __tact_tuple_destroy_1(tuple v)", - }, - { - "code": { - "code": "2 TUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_2", - "signature": "forall X0, X1 -> tuple __tact_tuple_create_2((X0, X1) v)", + "name": "__tact_dict_next_slice_uint", + "signature": "(slice, int, int) __tact_dict_next_slice_uint(cell d, int kl, slice pivot, int vl)", }, { "code": { - "code": "2 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return (dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_2", - "signature": "forall X0, X1 -> (X0, X1) __tact_tuple_destroy_2(tuple v)", - }, - { - "code": { - "code": "3 TUPLE", - "kind": "asm", - "shuffle": "", + "depends": Set { + "__tact_dict_delete", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_3", - "signature": "forall X0, X1, X2 -> tuple __tact_tuple_create_3((X0, X1, X2) v)", - }, - { - "code": { - "code": "3 UNTUPLE", - "kind": "asm", - "shuffle": "", + "flags": Set { + "inline", }, - "comment": null, - "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_3", - "signature": "forall X0, X1, X2 -> (X0, X1, X2) __tact_tuple_destroy_3(tuple v)", + "name": "__tact_dict_set_slice_uint", + "signature": "(cell, ()) __tact_dict_set_slice_uint(cell d, int kl, slice k, int v, int vl)", }, - { - "code": { - "code": "4 TUPLE", - "kind": "asm", - "shuffle": "", + { + "code": { + "code": "var (r, ok) = __tact_dict_get_ref(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_4", - "signature": "forall X0, X1, X2, X3 -> tuple __tact_tuple_create_4((X0, X1, X2, X3) v)", + "depends": Set { + "__tact_dict_get_ref", + }, + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_slice_cell", + "signature": "cell __tact_dict_get_slice_cell(cell d, int kl, slice k)", }, { "code": { - "code": "4 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_min_ref(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_4", - "signature": "forall X0, X1, X2, X3 -> (X0, X1, X2, X3) __tact_tuple_destroy_4(tuple v)", + "depends": Set { + "__tact_dict_min_ref", + }, + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_slice_cell", + "signature": "(slice, cell, int) __tact_dict_min_slice_cell(cell d, int kl)", }, { "code": { - "code": "5 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = __tact_dict_next(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_5", - "signature": "forall X0, X1, X2, X3, X4 -> tuple __tact_tuple_create_5((X0, X1, X2, X3, X4) v)", + "depends": Set { + "__tact_dict_next", + }, + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_slice_cell", + "signature": "(slice, cell, int) __tact_dict_next_slice_cell(cell d, int kl, slice pivot)", }, { "code": { - "code": "5 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = __tact_dict_delete(d, kl, k); + return (r, ()); +} else { + return __tact_dict_set_ref(d, kl, k, v); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_5", - "signature": "forall X0, X1, X2, X3, X4 -> (X0, X1, X2, X3, X4) __tact_tuple_destroy_5(tuple v)", + "depends": Set { + "__tact_dict_delete", + "__tact_dict_set_ref", + }, + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_slice_cell", + "signature": "(cell, ()) __tact_dict_set_slice_cell(cell d, int kl, slice k, cell v)", }, { "code": { - "code": "6 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_6", - "signature": "forall X0, X1, X2, X3, X4, X5 -> tuple __tact_tuple_create_6((X0, X1, X2, X3, X4, X5) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_slice", + "signature": "slice __tact_dict_get_uint_slice(cell d, int kl, int k)", }, { "code": { - "code": "6 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_6", - "signature": "forall X0, X1, X2, X3, X4, X5 -> (X0, X1, X2, X3, X4, X5) __tact_tuple_destroy_6(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_slice", + "signature": "(int, slice, int) __tact_dict_min_uint_slice(cell d, int kl)", }, { "code": { - "code": "7 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_7", - "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> tuple __tact_tuple_create_7((X0, X1, X2, X3, X4, X5, X6) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_slice", + "signature": "(int, slice, int) __tact_dict_next_uint_slice(cell d, int kl, int pivot)", }, { "code": { - "code": "7 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_7", - "signature": "forall X0, X1, X2, X3, X4, X5, X6 -> (X0, X1, X2, X3, X4, X5, X6) __tact_tuple_destroy_7(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_slice", + "signature": "(cell, ()) __tact_dict_set_uint_slice(cell d, int kl, int k, slice v)", }, { "code": { - "code": "8 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_8", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> tuple __tact_tuple_create_8((X0, X1, X2, X3, X4, X5, X6, X7) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_int", + "signature": "int __tact_dict_get_uint_int(cell d, int kl, int k, int vl)", }, { "code": { - "code": "8 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_8", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7 -> (X0, X1, X2, X3, X4, X5, X6, X7) __tact_tuple_destroy_8(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_int", + "signature": "(int, int, int) __tact_dict_min_uint_int(cell d, int kl, int vl)", }, { "code": { - "code": "9 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_9", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> tuple __tact_tuple_create_9((X0, X1, X2, X3, X4, X5, X6, X7, X8) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_int", + "signature": "(int, int, int) __tact_dict_next_uint_int(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "9 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_9", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8) __tact_tuple_destroy_9(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_int", + "signature": "(cell, ()) __tact_dict_set_uint_int(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "10 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get?(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_10", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> tuple __tact_tuple_create_10((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_uint", + "signature": "int __tact_dict_get_uint_uint(cell d, int kl, int k, int vl)", }, { "code": { - "code": "10 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min?(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_10", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __tact_tuple_destroy_10(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_uint", + "signature": "(int, int, int) __tact_dict_min_uint_uint(cell d, int kl, int vl)", }, { "code": { - "code": "11 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_11", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> tuple __tact_tuple_create_11((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_uint", + "signature": "(int, int, int) __tact_dict_next_uint_uint(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "11 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_11", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __tact_tuple_destroy_11(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_uint", + "signature": "(cell, ()) __tact_dict_set_uint_uint(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "12 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = udict_get_ref?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_12", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> tuple __tact_tuple_create_12((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_uint_cell", + "signature": "cell __tact_dict_get_uint_cell(cell d, int kl, int k)", }, { "code": { - "code": "12 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_min_ref?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_12", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __tact_tuple_destroy_12(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_uint_cell", + "signature": "(int, cell, int) __tact_dict_min_uint_cell(cell d, int kl)", }, { "code": { - "code": "13 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = udict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_13", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> tuple __tact_tuple_create_13((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_uint_cell", + "signature": "(int, cell, int) __tact_dict_next_uint_cell(cell d, int kl, int pivot)", }, { "code": { - "code": "13 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = udict_delete?(d, kl, k); + return (r, ()); +} else { + return (udict_set_ref(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_13", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __tact_tuple_destroy_13(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_uint_cell", + "signature": "(cell, ()) __tact_dict_set_uint_cell(cell d, int kl, int k, cell v)", }, { "code": { - "code": "14 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r; +} else { + return null(); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_14", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> tuple __tact_tuple_create_14((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_int_slice", + "signature": "slice __tact_dict_get_int_slice(cell d, int kl, int k)", }, { "code": { - "code": "14 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_14", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __tact_tuple_destroy_14(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_int_slice", + "signature": "(int, slice, int) __tact_dict_min_int_slice(cell d, int kl)", }, { "code": { - "code": "15 TUPLE", - "kind": "asm", - "shuffle": "", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_create_15", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> tuple __tact_tuple_create_15((X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_int_slice", + "signature": "(int, slice, int) __tact_dict_next_int_slice(cell d, int kl, int pivot)", }, { "code": { - "code": "15 UNTUPLE", - "kind": "asm", - "shuffle": "", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set(d, kl, k, v), ()); +}", + "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_tuple_destroy_15", - "signature": "forall X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14 -> (X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __tact_tuple_destroy_15(tuple v)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_set_int_slice", + "signature": "(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v)", }, { "code": { - "code": "return tpush(tpush(empty_tuple(), b), null());", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r~load_int(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, @@ -9465,66 +9548,74 @@ return data;", "flags": Set { "inline", }, - "name": "__tact_string_builder_start", - "signature": "tuple __tact_string_builder_start(builder b)", + "name": "__tact_dict_get_int_int", + "signature": "int __tact_dict_get_int_int(cell d, int kl, int k, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 32));", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_comment", - "signature": "tuple __tact_string_builder_start_comment()", + "name": "__tact_dict_min_int_int", + "signature": "(int, int, int) __tact_dict_min_int_int(cell d, int kl, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell().store_uint(0, 8));", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_int(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_tail_string", - "signature": "tuple __tact_string_builder_start_tail_string()", + "name": "__tact_dict_next_int_int", + "signature": "(int, int, int) __tact_dict_next_int_int(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "return __tact_string_builder_start(begin_cell());", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_start", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_start_string", - "signature": "tuple __tact_string_builder_start_string()", + "name": "__tact_dict_set_int_int", + "signature": "(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "(builder b, tuple tail) = uncons(builders); -cell c = b.end_cell(); -while(~ null?(tail)) { - (b, tail) = uncons(tail); - c = b.store_ref(c).end_cell(); -} -return c;", + "code": "var (r, ok) = idict_get?(d, kl, k); +if (ok) { + return r~load_uint(vl); +} else { + return null(); +}", "kind": "generic", }, "comment": null, @@ -9533,203 +9624,112 @@ return c;", "flags": Set { "inline", }, - "name": "__tact_string_builder_end", - "signature": "cell __tact_string_builder_end(tuple builders)", + "name": "__tact_dict_get_int_uint", + "signature": "int __tact_dict_get_int_uint(cell d, int kl, int k, int vl)", }, { "code": { - "code": "return __tact_string_builder_end(builders).begin_parse();", + "code": "var (key, value, flag) = idict_get_min?(d, kl); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_end", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_string_builder_end_slice", - "signature": "slice __tact_string_builder_end_slice(tuple builders)", + "name": "__tact_dict_min_int_uint", + "signature": "(int, int, int) __tact_dict_min_int_uint(cell d, int kl, int vl)", }, { "code": { - "code": "int sliceRefs = slice_refs(sc); -int sliceBits = slice_bits(sc); - -while((sliceBits > 0) | (sliceRefs > 0)) { - - ;; Load the current builder - (builder b, tuple tail) = uncons(builders); - int remBytes = 127 - (builder_bits(b) / 8); - int exBytes = sliceBits / 8; - - ;; Append bits - int amount = min(remBytes, exBytes); - if (amount > 0) { - slice read = sc~load_bits(amount * 8); - b = b.store_slice(read); - } - - ;; Update builders - builders = cons(b, tail); - - ;; Check if we need to add a new cell and continue - if (exBytes - amount > 0) { - var bb = begin_cell(); - builders = cons(bb, builders); - sliceBits = (exBytes - amount) * 8; - } elseif (sliceRefs > 0) { - sc = sc~load_ref().begin_parse(); - sliceRefs = slice_refs(sc); - sliceBits = slice_bits(sc); - } else { - sliceBits = 0; - sliceRefs = 0; - } -} - -return ((builders), ());", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_uint(vl), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_string_builder_append", - "signature": "((tuple), ()) __tact_string_builder_append(tuple builders, slice sc)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_next_int_uint", + "signature": "(int, int, int) __tact_dict_next_int_uint(cell d, int kl, int pivot, int vl)", }, { "code": { - "code": "builders~__tact_string_builder_append(sc); -return builders;", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); +}", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_string_builder_append", + "depends": Set {}, + "flags": Set { + "inline", }, - "flags": Set {}, - "name": "__tact_string_builder_append_not_mut", - "signature": "(tuple) __tact_string_builder_append_not_mut(tuple builders, slice sc)", + "name": "__tact_dict_set_int_uint", + "signature": "(cell, ()) __tact_dict_set_int_uint(cell d, int kl, int k, int v, int vl)", }, { "code": { - "code": "var b = begin_cell(); -if (src < 0) { - b = b.store_uint(45, 8); - src = - src; -} - -if (src < 1000000000000000000000000000000) { - int len = 0; - int value = 0; - int mult = 1; - do { - (src, int res) = src.divmod(10); - value = value + (res + 48) * mult; - mult = mult * 256; - len = len + 1; - } until (src == 0); - - b = b.store_uint(value, len * 8); + "code": "var (r, ok) = idict_get_ref?(d, kl, k); +if (ok) { + return r; } else { - tuple t = empty_tuple(); - int len = 0; - do { - int digit = src % 10; - t~tpush(digit); - len = len + 1; - src = src / 10; - } until (src == 0); - - int c = len - 1; - repeat(len) { - int v = t.at(c); - b = b.store_uint(v + 48, 8); - c = c - 1; - } -} -return b.end_cell().begin_parse();", + return null(); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_int_to_string", - "signature": "slice __tact_int_to_string(int src)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_get_int_cell", + "signature": "cell __tact_dict_get_int_cell(cell d, int kl, int k)", }, { "code": { - "code": "throw_if(134, (digits <= 0) | (digits > 77)); -builder b = begin_cell(); - -if (src < 0) { - b = b.store_uint(45, 8); - src = - src; -} - -;; Process rem part -int skip = true; -int len = 0; -int rem = 0; -tuple t = empty_tuple(); -repeat(digits) { - (src, rem) = src.divmod(10); - if ( ~ ( skip & ( rem == 0 ) ) ) { - skip = false; - t~tpush(rem + 48); - len = len + 1; - } -} - -;; Process dot -if (~ skip) { - t~tpush(46); - len = len + 1; -} - -;; Main -do { - (src, rem) = src.divmod(10); - t~tpush(rem + 48); - len = len + 1; -} until (src == 0); - -;; Assemble -int c = len - 1; -repeat(len) { - int v = t.at(c); - b = b.store_uint(v, 8); - c = c - 1; -} - -;; Result -return b.end_cell().begin_parse();", + "code": "var (key, value, flag) = idict_get_min_ref?(d, kl); +if (flag) { + return (key, value, flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, "context": "stdlib", "depends": Set {}, - "flags": Set {}, - "name": "__tact_float_to_string", - "signature": "slice __tact_float_to_string(int src, int digits)", + "flags": Set { + "inline", + }, + "name": "__tact_dict_min_int_cell", + "signature": "(int, cell, int) __tact_dict_min_int_cell(cell d, int kl)", }, { "code": { - "code": "throw_unless(5, num > 0); -throw_unless(5, base > 1); -if (num < base) { - return 0; -} -int result = 0; -while (num >= base) { - num /= base; - result += 1; -} -return result;", + "code": "var (key, value, flag) = idict_get_next?(d, kl, pivot); +if (flag) { + return (key, value~load_ref(), flag); +} else { + return (null(), null(), flag); +}", "kind": "generic", }, "comment": null, @@ -9738,17 +9738,17 @@ return result;", "flags": Set { "inline", }, - "name": "__tact_log", - "signature": "int __tact_log(int num, int base)", + "name": "__tact_dict_next_int_cell", + "signature": "(int, cell, int) __tact_dict_next_int_cell(cell d, int kl, int pivot)", }, { "code": { - "code": "throw_unless(5, exp >= 0); -int result = 1; -repeat (exp) { - result *= base; -} -return result;", + "code": "if (null?(v)) { + var (r, ok) = idict_delete?(d, kl, k); + return (r, ()); +} else { + return (idict_set_ref(d, kl, k, v), ()); +}", "kind": "generic", }, "comment": null, @@ -9757,23 +9757,25 @@ return result;", "flags": Set { "inline", }, - "name": "__tact_pow", - "signature": "int __tact_pow(int base, int exp)", + "name": "__tact_dict_set_int_cell", + "signature": "(cell, ()) __tact_dict_set_int_cell(cell d, int kl, int k, cell v)", }, { "code": { - "code": "var (r, ok) = idict_get?(d, kl, k); + "code": "var (r, ok) = __tact_dict_get(d, kl, k); return ok;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set {}, + "depends": Set { + "__tact_dict_get", + }, "flags": Set { "inline", }, - "name": "__tact_dict_exists_int", - "signature": "int __tact_dict_exists_int(cell d, int kl, int k)", + "name": "__tact_dict_exists_slice", + "signature": "int __tact_dict_exists_slice(cell d, int kl, slice k)", }, { "code": { @@ -9792,20 +9794,18 @@ return ok;", }, { "code": { - "code": "var (r, ok) = __tact_dict_get(d, kl, k); + "code": "var (r, ok) = idict_get?(d, kl, k); return ok;", "kind": "generic", }, "comment": null, "context": "stdlib", - "depends": Set { - "__tact_dict_get", - }, + "depends": Set {}, "flags": Set { "inline", }, - "name": "__tact_dict_exists_slice", - "signature": "int __tact_dict_exists_slice(cell d, int kl, slice k)", + "name": "__tact_dict_exists_int", + "signature": "int __tact_dict_exists_int(cell d, int kl, int k)", }, { "code": { diff --git a/src/generator/writers/writeStdlib.ts b/src/generator/writers/writeStdlib.ts index 8872dbcd3..25e5e9b03 100644 --- a/src/generator/writers/writeStdlib.ts +++ b/src/generator/writers/writeStdlib.ts @@ -1,9 +1,10 @@ import { contractErrors } from "../../abi/errors"; import { maxTupleSize } from "../../bindings/typescript/writeStruct"; import { enabledMasterchain } from "../../config/features"; +import { throwInternalCompilerError } from "../../errors"; import { WriterContext } from "../Writer"; -export function writeStdlib(ctx: WriterContext) { +export function writeStdlib(ctx: WriterContext): void { // // stdlib extension functions // @@ -455,907 +456,6 @@ export function writeStdlib(ctx: WriterContext) { ctx.asm("", "NOP"); }); - // - // Dict Int -> Int - // - - ctx.fun("__tact_dict_set_int_int", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_int_int(cell d, int kl, int k, int v, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); - } else { - return (idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_int_int", () => { - ctx.signature( - `int __tact_dict_get_int_int(cell d, int kl, int k, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = idict_get?(d, kl, k); - if (ok) { - return r~load_int(vl); - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_int_int", () => { - ctx.signature( - `(int, int, int) __tact_dict_min_int_int(cell d, int kl, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_min?(d, kl); - if (flag) { - return (key, value~load_int(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_int_int", () => { - ctx.signature( - `(int, int, int) __tact_dict_next_int_int(cell d, int kl, int pivot, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_next?(d, kl, pivot); - if (flag) { - return (key, value~load_int(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Int -> Int - // - - ctx.fun("__tact_dict_set_int_uint", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_int_uint(cell d, int kl, int k, int v, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); - } else { - return (idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_int_uint", () => { - ctx.signature( - `int __tact_dict_get_int_uint(cell d, int kl, int k, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = idict_get?(d, kl, k); - if (ok) { - return r~load_uint(vl); - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_int_uint", () => { - ctx.signature( - `(int, int, int) __tact_dict_min_int_uint(cell d, int kl, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_min?(d, kl); - if (flag) { - return (key, value~load_uint(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_int_uint", () => { - ctx.signature( - `(int, int, int) __tact_dict_next_int_uint(cell d, int kl, int pivot, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_next?(d, kl, pivot); - if (flag) { - return (key, value~load_uint(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Uint -> Int - // - - ctx.fun("__tact_dict_set_uint_int", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_uint_int(cell d, int kl, int k, int v, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); - } else { - return (udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_uint_int", () => { - ctx.signature( - `int __tact_dict_get_uint_int(cell d, int kl, int k, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = udict_get?(d, kl, k); - if (ok) { - return r~load_int(vl); - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_uint_int", () => { - ctx.signature( - `(int, int, int) __tact_dict_min_uint_int(cell d, int kl, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_min?(d, kl); - if (flag) { - return (key, value~load_int(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_uint_int", () => { - ctx.signature( - `(int, int, int) __tact_dict_next_uint_int(cell d, int kl, int pivot, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_next?(d, kl, pivot); - if (flag) { - return (key, value~load_int(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Uint -> Uint - // - - ctx.fun("__tact_dict_set_uint_uint", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_uint_uint(cell d, int kl, int k, int v, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); - } else { - return (udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_uint_uint", () => { - ctx.signature( - `int __tact_dict_get_uint_uint(cell d, int kl, int k, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = udict_get?(d, kl, k); - if (ok) { - return r~load_uint(vl); - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_uint_uint", () => { - ctx.signature( - `(int, int, int) __tact_dict_min_uint_uint(cell d, int kl, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_min?(d, kl); - if (flag) { - return (key, value~load_uint(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_uint_uint", () => { - ctx.signature( - `(int, int, int) __tact_dict_next_uint_uint(cell d, int kl, int pivot, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_next?(d, kl, pivot); - if (flag) { - return (key, value~load_uint(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Int -> Cell - // - - ctx.fun("__tact_dict_set_int_cell", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_int_cell(cell d, int kl, int k, cell v)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); - } else { - return (idict_set_ref(d, kl, k, v), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_int_cell", () => { - ctx.signature(`cell __tact_dict_get_int_cell(cell d, int kl, int k)`); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = idict_get_ref?(d, kl, k); - if (ok) { - return r; - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_int_cell", () => { - ctx.signature( - `(int, cell, int) __tact_dict_min_int_cell(cell d, int kl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_min_ref?(d, kl); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_int_cell", () => { - ctx.signature( - `(int, cell, int) __tact_dict_next_int_cell(cell d, int kl, int pivot)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_next?(d, kl, pivot); - if (flag) { - return (key, value~load_ref(), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Uint -> Cell - // - - ctx.fun("__tact_dict_set_uint_cell", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_uint_cell(cell d, int kl, int k, cell v)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); - } else { - return (udict_set_ref(d, kl, k, v), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_uint_cell", () => { - ctx.signature(`cell __tact_dict_get_uint_cell(cell d, int kl, int k)`); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = udict_get_ref?(d, kl, k); - if (ok) { - return r; - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_uint_cell", () => { - ctx.signature( - `(int, cell, int) __tact_dict_min_uint_cell(cell d, int kl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_min_ref?(d, kl); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_uint_cell", () => { - ctx.signature( - `(int, cell, int) __tact_dict_next_uint_cell(cell d, int kl, int pivot)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_next?(d, kl, pivot); - if (flag) { - return (key, value~load_ref(), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Int -> Slice - // - - ctx.fun("__tact_dict_set_int_slice", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_int_slice(cell d, int kl, int k, slice v)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = idict_delete?(d, kl, k); - return (r, ()); - } else { - return (idict_set(d, kl, k, v), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_int_slice", () => { - ctx.signature(`slice __tact_dict_get_int_slice(cell d, int kl, int k)`); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = idict_get?(d, kl, k); - if (ok) { - return r; - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_int_slice", () => { - ctx.signature( - `(int, slice, int) __tact_dict_min_int_slice(cell d, int kl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_min?(d, kl); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_int_slice", () => { - ctx.signature( - `(int, slice, int) __tact_dict_next_int_slice(cell d, int kl, int pivot)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = idict_get_next?(d, kl, pivot); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Uint -> Slice - // - - ctx.fun("__tact_dict_set_uint_slice", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_uint_slice(cell d, int kl, int k, slice v)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = udict_delete?(d, kl, k); - return (r, ()); - } else { - return (udict_set(d, kl, k, v), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_uint_slice", () => { - ctx.signature( - `slice __tact_dict_get_uint_slice(cell d, int kl, int k)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = udict_get?(d, kl, k); - if (ok) { - return r; - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_uint_slice", () => { - ctx.signature( - `(int, slice, int) __tact_dict_min_uint_slice(cell d, int kl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_min?(d, kl); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_uint_slice", () => { - ctx.signature( - `(int, slice, int) __tact_dict_next_uint_slice(cell d, int kl, int pivot)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = udict_get_next?(d, kl, pivot); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Slice -> Int - // - - ctx.fun("__tact_dict_set_slice_int", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_slice_int(cell d, int kl, slice k, int v, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = ${ctx.used(`__tact_dict_delete`)}(d, kl, k); - return (r, ()); - } else { - return (dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_slice_int", () => { - ctx.signature( - `int __tact_dict_get_slice_int(cell d, int kl, slice k, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = ${ctx.used(`__tact_dict_get`)}(d, kl, k); - if (ok) { - return r~load_int(vl); - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_slice_int", () => { - ctx.signature( - `(slice, int, int) __tact_dict_min_slice_int(cell d, int kl, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = ${ctx.used(`__tact_dict_min`)}(d, kl); - if (flag) { - return (key, value~load_int(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_slice_int", () => { - ctx.signature( - `(slice, int, int) __tact_dict_next_slice_int(cell d, int kl, slice pivot, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = ${ctx.used(`__tact_dict_next`)}(d, kl, pivot); - if (flag) { - return (key, value~load_int(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Slice -> UInt - // - - ctx.fun("__tact_dict_set_slice_uint", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_slice_uint(cell d, int kl, slice k, int v, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = ${ctx.used(`__tact_dict_delete`)}(d, kl, k); - return (r, ()); - } else { - return (dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ()); - } - `); - }); - }); - - ctx.fun("__tact_dict_get_slice_uint", () => { - ctx.signature( - `int __tact_dict_get_slice_uint(cell d, int kl, slice k, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = ${ctx.used(`__tact_dict_get`)}(d, kl, k); - if (ok) { - return r~load_uint(vl); - } else { - return null(); - } - `); - }); - }); - - ctx.fun("__tact_dict_min_slice_uint", () => { - ctx.signature( - `(slice, int, int) __tact_dict_min_slice_uint(cell d, int kl, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = ${ctx.used(`__tact_dict_min`)}(d, kl); - if (flag) { - return (key, value~load_uint(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun("__tact_dict_next_slice_uint", () => { - ctx.signature( - `(slice, int, int) __tact_dict_next_slice_uint(cell d, int kl, slice pivot, int vl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = ${ctx.used(`__tact_dict_next`)}(d, kl, pivot); - if (flag) { - return (key, value~load_uint(vl), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Slice -> Cell - // - - ctx.fun("__tact_dict_set_slice_cell", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_slice_cell(cell d, int kl, slice k, cell v)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = ${ctx.used(`__tact_dict_delete`)}(d, kl, k); - return (r, ()); - } else { - return ${ctx.used(`__tact_dict_set_ref`)}(d, kl, k, v); - } - `); - }); - }); - - ctx.fun(`__tact_dict_get_slice_cell`, () => { - ctx.signature( - `cell __tact_dict_get_slice_cell(cell d, int kl, slice k)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = ${ctx.used(`__tact_dict_get_ref`)}(d, kl, k); - if (ok) { - return r; - } else { - return null(); - } - `); - }); - }); - - ctx.fun(`__tact_dict_min_slice_cell`, () => { - ctx.signature( - `(slice, cell, int) __tact_dict_min_slice_cell(cell d, int kl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = ${ctx.used(`__tact_dict_min_ref`)}(d, kl); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun(`__tact_dict_next_slice_cell`, () => { - ctx.signature( - `(slice, cell, int) __tact_dict_next_slice_cell(cell d, int kl, slice pivot)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = ${ctx.used(`__tact_dict_next`)}(d, kl, pivot); - if (flag) { - return (key, value~load_ref(), flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - // - // Dict Slice -> Slice - // - - ctx.fun("__tact_dict_set_slice_slice", () => { - ctx.signature( - `(cell, ()) __tact_dict_set_slice_slice(cell d, int kl, slice k, slice v)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - if (null?(v)) { - var (r, ok) = ${ctx.used(`__tact_dict_delete`)}(d, kl, k); - return (r, ()); - } else { - return (dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ()); - } - `); - }); - }); - - ctx.fun(`__tact_dict_get_slice_slice`, () => { - ctx.signature( - `slice __tact_dict_get_slice_slice(cell d, int kl, slice k)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = ${ctx.used(`__tact_dict_get`)}(d, kl, k); - if (ok) { - return r; - } else { - return null(); - } - `); - }); - }); - - ctx.fun(`__tact_dict_min_slice_slice`, () => { - ctx.signature( - `(slice, slice, int) __tact_dict_min_slice_slice(cell d, int kl)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (key, value, flag) = ${ctx.used(`__tact_dict_min`)}(d, kl); - if (flag) { - return (key, value, flag); - } else { - return (null(), null(), flag); - } - `); - }); - }); - - ctx.fun(`__tact_dict_next_slice_slice`, () => { - ctx.signature( - `(slice, slice, int) __tact_dict_next_slice_slice(cell d, int kl, slice pivot)`, - ); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - return ${ctx.used(`__tact_dict_next`)}(d, kl, pivot); - `); - }); - }); - // // Address // @@ -1968,43 +1068,322 @@ export function writeStdlib(ctx: WriterContext) { }); }); - // - // Dict Exists - // + // generate dict operations for all combinations of key/value types + for (const key of keyTypes) { + for (const val of valTypes) { + genTactDictGet(ctx, key, val); + genTactDictGetMin(ctx, key, val); + genTactDictGetNext(ctx, key, val); + genTactDictSet(ctx, key, val); + } + } + for (const key of keyTypes) { + genTactDictExists(ctx, key); + } +} - ctx.fun("__tact_dict_exists_int", () => { - ctx.signature(`int __tact_dict_exists_int(cell d, int kl, int k)`); - ctx.flag("inline"); - ctx.context("stdlib"); - ctx.body(() => { - ctx.write(` - var (r, ok) = idict_get?(d, kl, k); - return ok; +const keyTypes = ["slice", "uint", "int"] as const; +type KeyType = (typeof keyTypes)[number]; + +const valTypes = ["slice", "int", "uint", "cell"] as const; +type ValType = (typeof valTypes)[number]; + +function genTactDictGet( + ctx: WriterContext, + key: KeyType, + value: ValType, +): void { + const signatureKeyType = key === "uint" ? "int" : key; + const signatureRetType = value === "uint" ? "int" : value; + const dictGet = () => { + const cellSuffix = value === "cell" ? "_ref" : ""; + switch (key) { + case "slice": + return ctx.used(`__tact_dict_get${cellSuffix}`); + case "uint": + return `udict_get${cellSuffix}?`; + case "int": + return `idict_get${cellSuffix}?`; + } + }; + const returnExpr = () => { + switch (value) { + case "slice": + case "cell": + return "r"; + case "uint": + return "r~load_uint(vl)"; + case "int": + return "r~load_int(vl)"; + } + }; + const valBitsArg = () => { + switch (value) { + case "slice": + case "cell": + return ""; + case "uint": + case "int": + return ", int vl"; + } + }; + ctx.fun(`__tact_dict_get_${key}_${value}`, () => { + ctx.signature( + `${signatureRetType} __tact_dict_get_${key}_${value}(cell d, int kl, ${signatureKeyType} k${valBitsArg()})`, + ); + ctx.flag("inline"); + ctx.context("stdlib"); + ctx.body(() => { + ctx.write(` + var (r, ok) = ${dictGet()}(d, kl, k); + if (ok) { + return ${returnExpr()}; + } else { + return null(); + } `); }); }); +} - ctx.fun("__tact_dict_exists_uint", () => { - ctx.signature(`int __tact_dict_exists_uint(cell d, int kl, int k)`); +function genTactDictExists(ctx: WriterContext, key: KeyType): void { + const signatureKeyType = key === "uint" ? "int" : key; + const dictGet = () => { + switch (key) { + case "slice": + return ctx.used("__tact_dict_get"); + case "uint": + return "udict_get?"; + case "int": + return "idict_get?"; + } + }; + ctx.fun(`__tact_dict_exists_${key}`, () => { + ctx.signature( + `int __tact_dict_exists_${key}(cell d, int kl, ${signatureKeyType} k)`, + ); ctx.flag("inline"); ctx.context("stdlib"); ctx.body(() => { ctx.write(` - var (r, ok) = udict_get?(d, kl, k); + var (r, ok) = ${dictGet()}(d, kl, k); return ok; `); }); }); +} - ctx.fun("__tact_dict_exists_slice", () => { - ctx.signature(`int __tact_dict_exists_slice(cell d, int kl, slice k)`); +function genTactDictSet( + ctx: WriterContext, + key: KeyType, + value: ValType, +): void { + const signatureKeyType = key === "uint" ? "int" : key; + const signatureValueType = value === "uint" ? "int" : value; + const valBitsArg = () => { + switch (value) { + case "slice": + case "cell": + return ""; + case "uint": + case "int": + return ", int vl"; + } + }; + const dictDel = () => { + switch (key) { + case "slice": + return ctx.used("__tact_dict_delete"); + case "uint": + return "udict_delete?"; + case "int": + return "idict_delete?"; + } + }; + const returnExpr = () => { + switch (`${key}:${value}`) { + case "int:int": + return "(idict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ())"; + case "int:uint": + return "(idict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ())"; + case "uint:int": + return "(udict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ())"; + case "uint:uint": + return "(udict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ())"; + case "slice:int": + return "(dict_set_builder(d, kl, k, begin_cell().store_int(v, vl)), ())"; + case "slice:uint": + return "(dict_set_builder(d, kl, k, begin_cell().store_uint(v, vl)), ())"; + case "int:cell": + return "(idict_set_ref(d, kl, k, v), ())"; + case "uint:cell": + return "(udict_set_ref(d, kl, k, v), ())"; + case "int:slice": + return "(idict_set(d, kl, k, v), ())"; + case "uint:slice": + return "(udict_set(d, kl, k, v), ())"; + case "slice:cell": + return `${ctx.used("__tact_dict_set_ref")}(d, kl, k, v)`; + case "slice:slice": + return "(dict_set_builder(d, kl, k, begin_cell().store_slice(v)), ())"; + default: + throwInternalCompilerError( + `Unprocessed combination of key/value types ${key}/${value} in dict set operation`, + ); + } + }; + ctx.fun(`__tact_dict_set_${key}_${value}`, () => { + ctx.signature( + `(cell, ()) __tact_dict_set_${key}_${value}(cell d, int kl, ${signatureKeyType} k, ${signatureValueType} v${valBitsArg()})`, + ); ctx.flag("inline"); ctx.context("stdlib"); ctx.body(() => { ctx.write(` - var (r, ok) = ${ctx.used(`__tact_dict_get`)}(d, kl, k); - return ok; + if (null?(v)) { + var (r, ok) = ${dictDel()}(d, kl, k); + return (r, ()); + } else { + return ${returnExpr()}; + } + `); + }); + }); +} + +function genTactDictGetMin( + ctx: WriterContext, + key: KeyType, + value: ValType, +): void { + const signatureKeyType = key === "uint" ? "int" : key; + const signatureValType = value === "uint" ? "int" : value; + const valBitsArg = () => { + switch (value) { + case "slice": + case "cell": + return ""; + case "uint": + case "int": + return ", int vl"; + } + }; + const dictGetMin = () => { + switch (`${key}:${value}`) { + case "int:int": + case "int:uint": + case "int:slice": + return "idict_get_min?"; + case "uint:int": + case "uint:uint": + case "uint:slice": + return "udict_get_min?"; + case "slice:int": + case "slice:uint": + case "slice:slice": + return ctx.used("__tact_dict_min"); + case "int:cell": + return "idict_get_min_ref?"; + case "uint:cell": + return "udict_get_min_ref?"; + case "slice:cell": + return ctx.used("__tact_dict_min_ref"); + default: + throwInternalCompilerError( + `Unprocessed combination of key/value types ${key}/${value} in dict get min operation`, + ); + } + }; + const returnValExpr = () => { + switch (value) { + case "int": + return "value~load_int(vl)"; + case "uint": + return "value~load_uint(vl)"; + case "slice": + case "cell": + return "value"; + } + }; + ctx.fun(`__tact_dict_min_${key}_${value}`, () => { + ctx.signature( + `(${signatureKeyType}, ${signatureValType}, int) __tact_dict_min_${key}_${value}(cell d, int kl${valBitsArg()})`, + ); + ctx.flag("inline"); + ctx.context("stdlib"); + ctx.body(() => { + ctx.write(` + var (key, value, flag) = ${dictGetMin()}(d, kl); + if (flag) { + return (key, ${returnValExpr()}, flag); + } else { + return (null(), null(), flag); + } `); }); }); } + +function genTactDictGetNext( + ctx: WriterContext, + key: KeyType, + value: ValType, +): void { + const signatureKeyType = key === "uint" ? "int" : key; + const signatureValType = value === "uint" ? "int" : value; + const valBitsArg = () => { + switch (value) { + case "slice": + case "cell": + return ""; + case "uint": + case "int": + return ", int vl"; + } + }; + const dictGetNext = () => { + switch (key) { + case "int": + return "idict_get_next?"; + case "uint": + return "udict_get_next?"; + case "slice": + return ctx.used("__tact_dict_next"); + } + }; + const returnValExpr = () => { + switch (value) { + case "int": + return "value~load_int(vl)"; + case "uint": + return "value~load_uint(vl)"; + case "slice": + return "value"; + case "cell": + return "value~load_ref()"; + } + }; + ctx.fun(`__tact_dict_next_${key}_${value}`, () => { + ctx.signature( + `(${signatureKeyType}, ${signatureValType}, int) __tact_dict_next_${key}_${value}(cell d, int kl, ${signatureKeyType} pivot${valBitsArg()})`, + ); + ctx.flag("inline"); + ctx.context("stdlib"); + ctx.body(() => { + if (key === "slice" && value === "slice") { + ctx.write(` + return ${ctx.used(`__tact_dict_next`)}(d, kl, pivot); + `); + } else { + ctx.write(` + var (key, value, flag) = ${dictGetNext()}(d, kl, pivot); + if (flag) { + return (key, ${returnValExpr()}, flag); + } else { + return (null(), null(), flag); + } + `); + } + }); + }); +}