mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
scripted-diff: Use std::span over Span
-BEGIN VERIFY SCRIPT-
ren() { sed -i "s!\<$1\>!$2!g" $( git grep -l "$1" -- "./src" ":(exclude)src/span.h" ":(exclude)src/leveldb/db/log_test.cc" ) ; }
ren Span std::span
ren AsBytes std::as_bytes
ren AsWritableBytes std::as_writable_bytes
sed -i 's!SpanPopBack(Span!SpanPopBack(std::span!g' ./src/span.h
-END VERIFY SCRIPT-
This commit is contained in:
@@ -505,7 +505,7 @@ public:
|
||||
// Handle requests for deterministic randomness.
|
||||
if (!always_use_real_rng && m_deterministic_prng.has_value()) [[unlikely]] {
|
||||
// Overwrite the beginning of buf, which will be used for output.
|
||||
m_deterministic_prng->Keystream(AsWritableBytes(Span{buf, num}));
|
||||
m_deterministic_prng->Keystream(std::as_writable_bytes(std::span{buf, num}));
|
||||
// Do not require strong seeding for deterministic output.
|
||||
ret = true;
|
||||
}
|
||||
@@ -673,13 +673,13 @@ void MakeRandDeterministicDANGEROUS(const uint256& seed) noexcept
|
||||
}
|
||||
std::atomic<bool> g_used_g_prng{false}; // Only accessed from tests
|
||||
|
||||
void GetRandBytes(Span<unsigned char> bytes) noexcept
|
||||
void GetRandBytes(std::span<unsigned char> bytes) noexcept
|
||||
{
|
||||
g_used_g_prng = true;
|
||||
ProcRand(bytes.data(), bytes.size(), RNGLevel::FAST, /*always_use_real_rng=*/false);
|
||||
}
|
||||
|
||||
void GetStrongRandBytes(Span<unsigned char> bytes) noexcept
|
||||
void GetStrongRandBytes(std::span<unsigned char> bytes) noexcept
|
||||
{
|
||||
ProcRand(bytes.data(), bytes.size(), RNGLevel::SLOW, /*always_use_real_rng=*/true);
|
||||
}
|
||||
@@ -698,7 +698,7 @@ void FastRandomContext::RandomSeed() noexcept
|
||||
requires_seed = false;
|
||||
}
|
||||
|
||||
void FastRandomContext::fillrand(Span<std::byte> output) noexcept
|
||||
void FastRandomContext::fillrand(std::span<std::byte> output) noexcept
|
||||
{
|
||||
if (requires_seed) RandomSeed();
|
||||
rng.Keystream(output);
|
||||
|
||||
Reference in New Issue
Block a user