diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-11-15 20:17:39 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-11-15 20:17:39 +0000 |
commit | d63c9dd2a033a1ce62e121f2beefb52989a16fe8 (patch) | |
tree | f93eb9a075bea8a122905302101393b6f73732b3 /libstdc++-v3/libsupc++/hash_bytes.cc | |
parent | 92b06c894860616d2bc499a12d15f05176b0e69d (diff) |
PR 59406 note that FNV hash functions are incorrect
PR libstdc++/59406
* include/bits/functional_hash.h: Add comment noting difference from
FNV-1a.
* include/tr1/functional_hash.h: Likewise.
* libsupc++/hash_bytes.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242454 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/libsupc++/hash_bytes.cc')
-rw-r--r-- | libstdc++-v3/libsupc++/hash_bytes.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libstdc++-v3/libsupc++/hash_bytes.cc b/libstdc++-v3/libsupc++/hash_bytes.cc index 1042de66388a..7d76c34edb40 100644 --- a/libstdc++-v3/libsupc++/hash_bytes.cc +++ b/libstdc++-v3/libsupc++/hash_bytes.cc @@ -112,6 +112,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // Implementation of FNV hash for 32-bit size_t. + // N.B. This function should work on unsigned char, otherwise it does not + // correctly implement the FNV-1a algorithm (see PR59406). + // The existing behaviour is retained for backwards compatibility. size_t _Fnv_hash_bytes(const void* ptr, size_t len, size_t hash) { @@ -157,6 +160,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // Implementation of FNV hash for 64-bit size_t. + // N.B. This function should work on unsigned char, otherwise it does not + // correctly implement the FNV-1a algorithm (see PR59406). + // The existing behaviour is retained for backwards compatibility. size_t _Fnv_hash_bytes(const void* ptr, size_t len, size_t hash) { |