mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Fix typos, UBs and warnings (#625)
This commit is contained in:
parent
5a47495d87
commit
0578cb4a42
19 changed files with 193 additions and 139 deletions
|
@ -289,7 +289,7 @@ struct MixedRadix {
|
|||
}
|
||||
|
||||
explicit operator long long() const {
|
||||
long long acc = 0.;
|
||||
unsigned long long acc = 0;
|
||||
for (int i = N - 1; i >= 0; --i) {
|
||||
acc = acc * mod[i] + a[i];
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ struct ModArray {
|
|||
}
|
||||
for (; i < size; i++) {
|
||||
pow += 8;
|
||||
acc = (acc << 8) + arr[i];
|
||||
acc = (acc * 256) + arr[i];
|
||||
if (pow >= 56) {
|
||||
lshift_add(pow, acc);
|
||||
acc = pow = 0;
|
||||
|
|
|
@ -186,7 +186,7 @@ td::RefInt256 make_special_int(int x, BInt* ptr = nullptr, unsigned char bin[64]
|
|||
int acc = b, r = ord;
|
||||
for (int i = 63; i >= 0; --i) {
|
||||
if (r < 8) {
|
||||
acc += (a << r);
|
||||
acc += ((unsigned)a << r);
|
||||
r = 1024;
|
||||
}
|
||||
r -= 8;
|
||||
|
@ -215,7 +215,7 @@ int randexp(int max = 63, int min = 0) {
|
|||
}
|
||||
|
||||
void bin_add_small(unsigned char bin[64], long long val, int shift = 0) {
|
||||
val <<= shift & 7;
|
||||
val *= (1 << (shift & 7));
|
||||
for (int i = 63 - (shift >> 3); i >= 0 && val; --i) {
|
||||
val += bin[i];
|
||||
bin[i] = (unsigned char)val;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue