mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 11:32:46 +01:00
Merge bitcoin/bitcoin#26827: doc: use "std lib clock" over "C++11 clock"
672f7ad747ecc6e04472f96fa88332be1f39d39b doc: remove usages of C++11 (fanquake) Pull request description: These were new in C++11, and now they are just our standard library. ACKs for top commit: jarolrod: re-ACK 672f7ad747ecc6e04472f96fa88332be1f39d39b hebasto: re-ACK 672f7ad747ecc6e04472f96fa88332be1f39d39b Tree-SHA512: 7e3b8b0346ba29b19e6d8536700ca510e2b543cdeecd9e740bba71ea6d0133dd96cdaeaa00f371f8ef85913ff5aaabe12878255f393dac7d354a8b89b58d050a
This commit is contained in:
parent
93c4652a05
commit
b6bde7322c
2
.github/ISSUE_TEMPLATE/good_first_issue.md
vendored
2
.github/ISSUE_TEMPLATE/good_first_issue.md
vendored
@ -15,7 +15,7 @@ assignees: ''
|
|||||||
|
|
||||||
#### Useful skills:
|
#### Useful skills:
|
||||||
|
|
||||||
<!-- (For example, “C++11 std::thread”, “Qt5 GUI and async GUI design” or “basic understanding of Bitcoin mining and the Bitcoin Core RPC interface”.) -->
|
<!-- (For example, “std::thread”, “Qt5 GUI and async GUI design” or “basic understanding of Bitcoin mining and the Bitcoin Core RPC interface”.) -->
|
||||||
|
|
||||||
#### Want to work on this issue?
|
#### Want to work on this issue?
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ static inline int64_t GetPerformanceCounter() noexcept
|
|||||||
__asm__ volatile ("rdtsc" : "=a"(r1), "=d"(r2)); // Constrain r1 to rax and r2 to rdx.
|
__asm__ volatile ("rdtsc" : "=a"(r1), "=d"(r2)); // Constrain r1 to rax and r2 to rdx.
|
||||||
return (r2 << 32) | r1;
|
return (r2 << 32) | r1;
|
||||||
#else
|
#else
|
||||||
// Fall back to using C++11 clock (usually microsecond or nanosecond precision)
|
// Fall back to using standard library clock (usually microsecond or nanosecond precision)
|
||||||
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -444,7 +444,7 @@ public:
|
|||||||
|
|
||||||
RNGState& GetRNGState() noexcept
|
RNGState& GetRNGState() noexcept
|
||||||
{
|
{
|
||||||
// This C++11 idiom relies on the guarantee that static variable are initialized
|
// This idiom relies on the guarantee that static variable are initialized
|
||||||
// on first call, even when multiple parallel calls are permitted.
|
// on first call, even when multiple parallel calls are permitted.
|
||||||
static std::vector<RNGState, secure_allocator<RNGState>> g_rng(1);
|
static std::vector<RNGState, secure_allocator<RNGState>> g_rng(1);
|
||||||
return g_rng[0];
|
return g_rng[0];
|
||||||
|
@ -232,7 +232,7 @@ public:
|
|||||||
/* interval [0..0] */ Dur{0};
|
/* interval [0..0] */ Dur{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Compatibility with the C++11 UniformRandomBitGenerator concept
|
// Compatibility with the UniformRandomBitGenerator concept
|
||||||
typedef uint64_t result_type;
|
typedef uint64_t result_type;
|
||||||
static constexpr uint64_t min() { return 0; }
|
static constexpr uint64_t min() { return 0; }
|
||||||
static constexpr uint64_t max() { return std::numeric_limits<uint64_t>::max(); }
|
static constexpr uint64_t max() { return std::numeric_limits<uint64_t>::max(); }
|
||||||
|
@ -251,7 +251,7 @@ void RandAddDynamicEnv(CSHA512& hasher)
|
|||||||
gettimeofday(&tv, nullptr);
|
gettimeofday(&tv, nullptr);
|
||||||
hasher << tv;
|
hasher << tv;
|
||||||
#endif
|
#endif
|
||||||
// Probably redundant, but also use all the clocks C++11 provides:
|
// Probably redundant, but also use all the standard library clocks:
|
||||||
hasher << std::chrono::system_clock::now().time_since_epoch().count();
|
hasher << std::chrono::system_clock::now().time_since_epoch().count();
|
||||||
hasher << std::chrono::steady_clock::now().time_since_epoch().count();
|
hasher << std::chrono::steady_clock::now().time_since_epoch().count();
|
||||||
hasher << std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
hasher << std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#define BITCOIN_REVERSE_ITERATOR_H
|
#define BITCOIN_REVERSE_ITERATOR_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template used for reverse iteration in C++11 range-based for loops.
|
* Template used for reverse iteration in range-based for loops.
|
||||||
*
|
*
|
||||||
* std::vector<int> v = {1, 2, 3, 4, 5};
|
* std::vector<int> v = {1, 2, 3, 4, 5};
|
||||||
* for (auto x : reverse_iterate(v))
|
* for (auto x : reverse_iterate(v))
|
||||||
|
@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(fastrandom_randbits)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Does-it-compile test for compatibility with standard C++11 RNG interface. */
|
/** Does-it-compile test for compatibility with standard library RNG interface. */
|
||||||
BOOST_AUTO_TEST_CASE(stdrandom_test)
|
BOOST_AUTO_TEST_CASE(stdrandom_test)
|
||||||
{
|
{
|
||||||
FastRandomContext ctx;
|
FastRandomContext ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user