mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #6080 from YosysHQ/emil/hashlib-noexcept
hashlib: noexcept moves for performance
This commit is contained in:
commit
7a2bd64c93
|
|
@ -423,6 +423,7 @@ class HASHLIB_ATTRIBUTE_WARN_UNUSED dict {
|
||||||
std::vector<int> hashtable;
|
std::vector<int> hashtable;
|
||||||
std::vector<entry_t> entries;
|
std::vector<entry_t> entries;
|
||||||
OPS ops;
|
OPS ops;
|
||||||
|
static_assert(std::is_nothrow_default_constructible_v<OPS>, "move ops are noexcept and default-construct OPS");
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
static inline void do_assert(bool) { }
|
static inline void do_assert(bool) { }
|
||||||
|
|
@ -641,7 +642,7 @@ public:
|
||||||
do_rehash();
|
do_rehash();
|
||||||
}
|
}
|
||||||
|
|
||||||
dict(dict &&other)
|
dict(dict &&other) noexcept
|
||||||
{
|
{
|
||||||
swap(other);
|
swap(other);
|
||||||
}
|
}
|
||||||
|
|
@ -652,7 +653,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
dict &operator=(dict &&other) {
|
dict &operator=(dict &&other) noexcept {
|
||||||
clear();
|
clear();
|
||||||
swap(other);
|
swap(other);
|
||||||
return *this;
|
return *this;
|
||||||
|
|
@ -901,6 +902,7 @@ protected:
|
||||||
std::vector<int> hashtable;
|
std::vector<int> hashtable;
|
||||||
std::vector<entry_t> entries;
|
std::vector<entry_t> entries;
|
||||||
OPS ops;
|
OPS ops;
|
||||||
|
static_assert(std::is_nothrow_default_constructible_v<OPS>, "move ops are noexcept and default-construct OPS");
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
static inline void do_assert(bool) { }
|
static inline void do_assert(bool) { }
|
||||||
|
|
@ -1091,7 +1093,7 @@ public:
|
||||||
do_rehash();
|
do_rehash();
|
||||||
}
|
}
|
||||||
|
|
||||||
pool(pool &&other)
|
pool(pool &&other) noexcept
|
||||||
{
|
{
|
||||||
swap(other);
|
swap(other);
|
||||||
}
|
}
|
||||||
|
|
@ -1102,7 +1104,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
pool &operator=(pool &&other) {
|
pool &operator=(pool &&other) noexcept {
|
||||||
clear();
|
clear();
|
||||||
swap(other);
|
swap(other);
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue