diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-05-02 14:43:35 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-05-02 14:43:35 +0000 |
commit | 34efdaf078b01a7387007c4e6bde6db86384c4b7 (patch) | |
tree | d503eaf41d085669d1481bb46ec038bc866fece6 /libstdc++-v3/libsupc++/hash_bytes.cc | |
parent | f733cf303bcdc952c92b81dd62199a40a1f555ec (diff) | |
download | gcc-tarball-master.tar.gz |
gcc-7.1.0gcc-7.1.0
Diffstat (limited to 'libstdc++-v3/libsupc++/hash_bytes.cc')
-rw-r--r-- | libstdc++-v3/libsupc++/hash_bytes.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libstdc++-v3/libsupc++/hash_bytes.cc b/libstdc++-v3/libsupc++/hash_bytes.cc index 2e5bbfaca1..8ef982dbc2 100644 --- a/libstdc++-v3/libsupc++/hash_bytes.cc +++ b/libstdc++-v3/libsupc++/hash_bytes.cc @@ -1,6 +1,6 @@ // Definition of _Hash_bytes. -*- C++ -*- -// Copyright (C) 2010-2016 Free Software Foundation, Inc. +// Copyright (C) 2010-2017 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -95,8 +95,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { case 3: hash ^= static_cast<unsigned char>(buf[2]) << 16; + [[gnu::fallthrough]]; case 2: hash ^= static_cast<unsigned char>(buf[1]) << 8; + [[gnu::fallthrough]]; case 1: hash ^= static_cast<unsigned char>(buf[0]); hash *= m; @@ -110,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) { @@ -155,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) { |