summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-20 10:35:43 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-20 10:35:43 +0000
commit7e017cd3debe0fdb83f4aff1c956002b74788bdb (patch)
tree7b42142e3353fc0d0297dda7bca34ee45f644084 /libstdc++-v3
parent2f182218f86be69c5a107780410b2c303c1539f2 (diff)
downloadgcc-7e017cd3debe0fdb83f4aff1c956002b74788bdb.tar.gz
2009-11-21 Paolo Carlini <paolo.carlini@oracle.com>
* src/compatibility-c++0x.cc (_Fnv_hash<4>, _Fnv_hash<8>): Add. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154361 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog4
-rw-r--r--libstdc++-v3/src/compatibility-c++0x.cc33
2 files changed, 37 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 83e740d18cb..3ae63049b92 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * src/compatibility-c++0x.cc (_Fnv_hash<4>, _Fnv_hash<8>): Add.
+
2009-11-19 Benjamin Kosnik <bkoz@redhat.com>
* src/pool_allocator.cc: Adjust catch blocks.
diff --git a/libstdc++-v3/src/compatibility-c++0x.cc b/libstdc++-v3/src/compatibility-c++0x.cc
index 0e92135d403..df28ecae358 100644
--- a/libstdc++-v3/src/compatibility-c++0x.cc
+++ b/libstdc++-v3/src/compatibility-c++0x.cc
@@ -57,6 +57,39 @@ namespace std
}
};
+ template<>
+ struct _Fnv_hash<4>
+ {
+ static size_t
+ hash(const char* __first, size_t __length)
+ {
+ size_t __result = static_cast<size_t>(2166136261UL);
+ for (; __length > 0; --__length)
+ {
+ __result ^= static_cast<size_t>(*__first++);
+ __result *= static_cast<size_t>(16777619UL);
+ }
+ return __result;
+ }
+ };
+
+ template<>
+ struct _Fnv_hash<8>
+ {
+ static size_t
+ hash(const char* __first, size_t __length)
+ {
+ size_t __result =
+ static_cast<size_t>(14695981039346656037ULL);
+ for (; __length > 0; --__length)
+ {
+ __result ^= static_cast<size_t>(*__first++);
+ __result *= static_cast<size_t>(1099511628211ULL);
+ }
+ return __result;
+ }
+ };
+
#include "hash.cc"
template<>