diff options
author | dcaswell <dylan.caswell@ni.com> | 2015-03-05 13:07:02 -0600 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-03-16 09:52:02 -0700 |
commit | 6f51dcc43f0a99854f0ef790aade4979c82b5272 (patch) | |
tree | 297cfef620744ddc69bf349324b8331f16be5b7b /host | |
parent | f97a3c6b3c1d3d50f088ccd8de03a945da6c9328 (diff) | |
download | uhd-6f51dcc43f0a99854f0ef790aade4979c82b5272.tar.gz uhd-6f51dcc43f0a99854f0ef790aade4979c82b5272.tar.bz2 uhd-6f51dcc43f0a99854f0ef790aade4979c82b5272.zip |
b200: Updated hashing algorithm for platform consistency
Now identical between 32- and 64-bit platforms.
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/b200/b200_iface.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 820090959..0f799e571 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -89,7 +89,7 @@ typedef boost::uint32_t hash_type; * Create a file hash * The hash will be used to identify the loaded firmware and fpga image * \param filename file used to generate hash value - * \return hash value in a size_t type + * \return hash value in a uint32_t type */ static hash_type generate_hash(const char *filename) { @@ -101,13 +101,15 @@ static hash_type generate_hash(const char *filename) throw uhd::io_error(std::string("cannot open input file ") + filename); } - size_t hash = 0; + hash_type hash = 0; char ch; long long count = 0; while (file.get(ch)) { count++; - boost::hash_combine(hash, ch); + //hash algorithm derived from boost hash_combine + //http://www.boost.org/doc/libs/1_35_0/doc/html/boost/hash_combine_id241013.html + hash ^= ch + 0x9e3779b9 + (hash<<6) + (hash>>2); } if (count == 0){ |