Skip to content

Commit

Permalink
feat: sliceLast -> lastBits, and make computeDataSize an extend…
Browse files Browse the repository at this point in the history
… function for both cell and slice
  • Loading branch information
Gusarich committed Nov 18, 2024
1 parent c88e882 commit 3d0e90e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
28 changes: 14 additions & 14 deletions src/imports/stdlib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,20 @@ files['std/cells.tact'] =
'IG11dGF0ZXMgbmF0aXZlIGxvYWRBZGRyZXNzKHNlbGY6IFNsaWNlKTogQWRkcmVzczsKCmFzbSBleHRlbmRzIG11dGF0ZXMgZnVuIHNraXBCaXRzKHNlbGY6IFNsaWNl' +
'LCBsOiBJbnQpIHsgU0RTS0lQRklSU1QgfQoKYXNtIGV4dGVuZHMgZnVuIGVuZFBhcnNlKHNlbGY6IFNsaWNlKSB7IEVORFMgfQoKYXNtIGV4dGVuZHMgZnVuIHNraXBM' +
'YXN0Qml0cyhzZWxmOiBTbGljZSwgbGVuOiBJbnQpOiBTbGljZSB7IFNEU0tJUExBU1QgfQoKYXNtIGV4dGVuZHMgZnVuIGZpcnN0Qml0cyhzZWxmOiBTbGljZSwgbGVu' +
'OiBJbnQpOiBTbGljZSB7IFNEQ1VURklSU1QgfQoKYXNtIGV4dGVuZHMgZnVuIHNsaWNlTGFzdChzZWxmOiBTbGljZSwgbGVuOiBJbnQpOiBTbGljZSB7IFNEQ1VUTEFT' +
'VCB9Cgphc20gZXh0ZW5kcyBmdW4gZGVwdGgoc2VsZjogU2xpY2UpOiBJbnQgeyBTREVQVEggfQoKLy8KLy8gU2xpY2Ugc2l6ZQovLwoKYXNtIGV4dGVuZHMgZnVuIHJl' +
'ZnMoc2VsZjogU2xpY2UpOiBJbnQgeyBTUkVGUyB9Cgphc20gZXh0ZW5kcyBmdW4gYml0cyhzZWxmOiBTbGljZSk6IEludCB7IFNCSVRTIH0KCmFzbSBleHRlbmRzIGZ1' +
'biBlbXB0eShzZWxmOiBTbG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IHJldHVybiBzZWxmLmJlZ2luUGFyc2UoKTsKfQoKaW5saW5lIGV4dGVuZHMgZnVuIGFzQ2VsbChzZWxmOiBT' +
'bGljZSk6IENlbGwgewogICAgcmV0dXJuIGJlZ2luQ2VsbCgpCiAgICAgICAgLnN0b3JlU2xpY2Uoc2VsZikKICAgICAgICAuZW5kQ2VsbCgpOwp9CgppbmxpbmUgZXh0' +
'ZW5kcyBmdW4gYXNDZWxsKHNlbGY6IEJ1aWxkZXIpOiBDZWxsIHsKICAgIHJldHVybiBzZWxmLmVuZENlbGwoKTsKfQoKaW5saW5lIGZ1biBlbXB0eUNlbGwoKTogQ2Vs' +
'bCB7CiAgICByZXR1cm4gYmVnaW5DZWxsKCkuZW5kQ2VsbCgpOwp9CgppbmxpbmUgZnVuIGVtcHR5U2xpY2UoKTogU2xpY2UgewogICAgcmV0dXJuIGVtcHR5Q2VsbCgp' +
'LmFzU2xpY2UoKTsKfQoKc3RydWN0IERhdGFTaXplIHsKICAgIGNlbGxzOiBJbnQ7CiAgICBiaXRzOiBJbnQ7CiAgICByZWZzOiBJbnQ7Cn0KCmFzbSBleHRlbmRzIGZ1' +
'biBjb21wdXRlRGF0YVNpemUoc2VsZjogQ2VsbCwgbWF4Q2VsbHM6IEludCk6IERhdGFTaXplIHsgQ0RBVEFTSVpFIFRSSVBMRSB9Cgphc20gZXh0ZW5kcyBmdW4gY29t' +
'cHV0ZURhdGFTaXplKHNlbGY6IFNsaWNlLCBtYXhDZWxsczogSW50KTogRGF0YVNpemUgeyBTREFUQVNJWkUgVFJJUExFIH0KCmFzbSBleHRlbmRzIGZ1biBkZXB0aChz' +
'ZWxmOiBDZWxsKTogSW50IHsgQ0RFUFRIIH0KCg==';
files['std/config.tact'] =
'YXNtIGZ1biBnZXRDb25maWdQYXJhbShpZDogSW50KTogQ2VsbD8geyBDT05GSUdPUFRQQVJBTSB9Cg==';
files['std/context.tact'] =
Expand Down
6 changes: 3 additions & 3 deletions stdlib/std/cells.tact
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ asm extends fun skipLastBits(self: Slice, len: Int): Slice { SDSKIPLAST }

asm extends fun firstBits(self: Slice, len: Int): Slice { SDCUTFIRST }

asm extends fun sliceLast(self: Slice, len: Int): Slice { SDCUTLAST }
asm extends fun lastBits(self: Slice, len: Int): Slice { SDCUTLAST }

asm extends fun depth(self: Slice): Int { SDEPTH }

Expand Down Expand Up @@ -208,9 +208,9 @@ struct DataSize {
refs: Int;
}

asm fun computeDataSize(cell: Cell, maxCells: Int): DataSize { CDATASIZE TRIPLE }
asm extends fun computeDataSize(self: Cell, maxCells: Int): DataSize { CDATASIZE TRIPLE }

asm fun computeSliceDataSize(slice: Slice, maxCells: Int): DataSize { SDATASIZE TRIPLE }
asm extends fun computeDataSize(self: Slice, maxCells: Int): DataSize { SDATASIZE TRIPLE }

asm extends fun depth(self: Cell): Int { CDEPTH }

0 comments on commit 3d0e90e

Please sign in to comment.