tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
372 stars 102 forks source link

`rawSlice()` should support bit padding #796

Closed Gusarich closed 2 weeks ago

Gusarich commented 3 weeks ago

This is a follow-up on #787

String literal type s in FunC supports bit padding. I'm sure that we should also support that for Tact's rawSlice(), because otherwise it won't be possible to define slices with binary data of length not divisible by 4.

This padding basically removes all the trailing zeros and also the last 1 bit before them. So, for example, 4a is 0100 1010 and 4a_ is 0100 10.

Gusarich commented 3 weeks ago

Also noticed the problem with hex strings with length not divisible by 2 - Buffer.from() just cuts the last digit in this case. I'll also fix this.