mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Prevector type
This commit is contained in:
@@ -46,7 +46,9 @@ template<typename X> static inline size_t DynamicUsage(const X * const &v) { ret
|
||||
static inline size_t MallocUsage(size_t alloc)
|
||||
{
|
||||
// Measured on libc6 2.19 on Linux.
|
||||
if (sizeof(void*) == 8) {
|
||||
if (alloc == 0) {
|
||||
return 0;
|
||||
} else if (sizeof(void*) == 8) {
|
||||
return ((alloc + 31) >> 4) << 4;
|
||||
} else if (sizeof(void*) == 4) {
|
||||
return ((alloc + 15) >> 3) << 3;
|
||||
@@ -74,6 +76,12 @@ static inline size_t DynamicUsage(const std::vector<X>& v)
|
||||
return MallocUsage(v.capacity() * sizeof(X));
|
||||
}
|
||||
|
||||
template<unsigned int N, typename X, typename S, typename D>
|
||||
static inline size_t DynamicUsage(const prevector<N, X, S, D>& v)
|
||||
{
|
||||
return MallocUsage(v.allocated_memory());
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
static inline size_t DynamicUsage(const std::set<X, Y>& s)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user