diff options
Diffstat (limited to 'gnuradio-runtime/lib/pmt/pmt.cc')
-rw-r--r-- | gnuradio-runtime/lib/pmt/pmt.cc | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/gnuradio-runtime/lib/pmt/pmt.cc b/gnuradio-runtime/lib/pmt/pmt.cc index 102c8b0fa2..e3c7f36f28 100644 --- a/gnuradio-runtime/lib/pmt/pmt.cc +++ b/gnuradio-runtime/lib/pmt/pmt.cc @@ -18,6 +18,7 @@ #include <pmt/pmt_pool.h> #include <stdio.h> #include <string.h> +#include <functional> #include <vector> namespace pmt { @@ -150,27 +151,11 @@ static std::vector<pmt_t>* get_symbol_hash_table() pmt_symbol::pmt_symbol(const std::string& name) : d_name(name) {} -static unsigned int hash_string(const std::string& s) -{ - unsigned int h = 0; - unsigned int g = 0; - - for (std::string::const_iterator p = s.begin(); p != s.end(); ++p) { - h = (h << 4) + (*p & 0xff); - g = h & 0xf0000000; - if (g) { - h = h ^ (g >> 24); - h = h ^ g; - } - } - return h; -} - bool is_symbol(const pmt_t& obj) { return obj->is_symbol(); } pmt_t string_to_symbol(const std::string& name) { - unsigned hash = hash_string(name) % get_symbol_hash_table_size(); + unsigned hash = std::hash<std::string>()(name) % get_symbol_hash_table_size(); // Does a symbol with this name already exist? for (pmt_t sym = (*get_symbol_hash_table())[hash]; sym; sym = _symbol(sym)->next()) { |