1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

pow-testgiver support

This commit is contained in:
ton 2020-07-06 17:07:20 +03:00
parent dbde9c1c40
commit f064b1047a
257 changed files with 6665 additions and 2608 deletions

View file

@ -267,6 +267,9 @@ class AnyIntView {
return size() > 1 ? (double)digits[size() - 1] + (double)digits[size() - 2] * (1.0 / Tr::Base)
: (double)digits[size() - 1];
}
bool is_odd_any() const {
return size() > 0 && (digits[0] & 1);
}
word_t to_long_any() const;
int parse_hex_any(const char* str, int str_len, int* frac = nullptr);
int parse_binary_any(const char* str, int str_len, int* frac = nullptr);
@ -658,6 +661,15 @@ class BigIntG {
word_t to_long() const {
return as_any_int().to_long_any();
}
bool is_odd() const {
return n > 0 && (digits[0] & 1);
}
bool is_even() const {
return n > 0 && !(digits[0] & 1);
}
word_t mod_pow2_short(int pow) const {
return n > 0 ? digits[0] & ((1 << pow) - 1) : 0;
}
private:
word_t top_word() const {

View file

@ -19,6 +19,7 @@
#pragma once
#include <string>
#include "td/utils/Slice.h"
#include "td/utils/Status.h"
#include "td/utils/buffer.h"
#include "bitstring.h"