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:
parent
dbde9c1c40
commit
f064b1047a
257 changed files with 6665 additions and 2608 deletions
|
@ -59,6 +59,15 @@ inline uint64 lower_bit64(uint64 x) {
|
|||
return x & bits_negate64(x);
|
||||
}
|
||||
|
||||
inline uint64 host_to_big_endian64(uint64 x) {
|
||||
// NB: works only for little-endian systems
|
||||
return bswap64(x);
|
||||
}
|
||||
inline uint64 big_endian_to_host64(uint64 x) {
|
||||
// NB: works only for little-endian systems
|
||||
return bswap64(x);
|
||||
}
|
||||
|
||||
//TODO: optimize
|
||||
inline int32 count_leading_zeroes_non_zero32(uint32 x) {
|
||||
DCHECK(x != 0);
|
||||
|
@ -145,7 +154,6 @@ inline int32 count_bits32(uint32 x) {
|
|||
x = (x + (x >> 4)) & 0x0F0F0F0F;
|
||||
x += x >> 8;
|
||||
return (x + (x >> 16)) & 0x3F;
|
||||
//return __popcnt(x);
|
||||
}
|
||||
|
||||
inline int32 count_bits64(uint64 x) {
|
||||
|
@ -215,11 +223,15 @@ inline uint64 bswap64(uint64 x) {
|
|||
}
|
||||
|
||||
inline int32 count_bits32(uint32 x) {
|
||||
return _popcnt32(static_cast<int>(x));
|
||||
x -= (x >> 1) & 0x55555555;
|
||||
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||||
x = (x + (x >> 4)) & 0x0F0F0F0F;
|
||||
x += x >> 8;
|
||||
return (x + (x >> 16)) & 0x3F;
|
||||
}
|
||||
|
||||
inline int32 count_bits64(uint64 x) {
|
||||
return _popcnt64(static_cast<__int64>(x));
|
||||
return count_bits32(static_cast<uint32>(x >> 32)) + count_bits32(static_cast<uint32>(x));
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue