1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00
This commit is contained in:
ton 2020-02-17 14:18:59 +04:00
parent a73d202ba2
commit 28735ddc9e
21 changed files with 856 additions and 218 deletions

View file

@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public License
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
Copyright 2017-2019 Telegram Systems LLP
Copyright 2017-2020 Telegram Systems LLP
*/
#include "common/refint.h"
#include <utility>
@ -213,12 +213,18 @@ int sgn(RefInt256 x) {
return x->sgn();
}
extern RefInt256 make_refint(long long x) {
RefInt256 make_refint(long long x) {
auto xx = td::RefInt256{true, x};
xx.unique_write().normalize();
return xx;
}
RefInt256 bits_to_refint(td::ConstBitPtr bits, int n, bool sgnd) {
td::RefInt256 x{true};
x.unique_write().import_bits(bits, n, sgnd);
return x;
}
std::string dec_string(RefInt256 x) {
return x.is_null() ? "(null)" : (x.is_unique() ? x.unique_write().to_dec_string_destroy() : x->to_dec_string());
}