Another place where a list of "all" types are explicitly listed, and
the __intN types need to be included, and elsewhere protection against
errors [-Wnarrowing] on targets that have small size_t.  Ok?

        * include/bits/functional_hash.h: Add specializations for __intN
        types.

        * include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp (__gnu_pbds):
        Guard against values that might exceed size_t's precision.
 

Index: libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
===================================================================
--- libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp     
(revision 226081)
+++ libstdc++-v3/include/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp     
(working copy)
@@ -267,36 +267,45 @@ namespace __gnu_pbds
        /* 18    */ 3571ul,
        /* 19    */ 5777ul,
        /* 20    */ 9349ul,
        /* 21    */ 15126ul,
        /* 22    */ 24476ul,
        /* 23    */ 39602ul,
-       /* 24    */ 64079ul,
+       /* 24    */ 64079ul
+#if __SIZE_MAX__ > 0xfffful
+       ,
        /* 25    */ 103681ul,
        /* 26    */ 167761ul,
        /* 27    */ 271442ul,
        /* 28    */ 439204ul,
-       /* 29    */ 710646ul,
+       /* 29    */ 710646ul
+#if __SIZE_MAX__ > 0xffffful
+       ,
        /* 30    */ 1149851ul,
        /* 31    */ 1860497ul,
        /* 32    */ 3010349ul,
        /* 33    */ 4870846ul,
        /* 34    */ 7881196ul,
-       /* 35    */ 12752042ul,
+       /* 35    */ 12752042ul
+#if __SIZE_MAX__ > 0xfffffful
+       ,
        /* 36    */ 20633239ul,
        /* 37    */ 33385282ul,
        /* 38    */ 54018521ul,
        /* 39    */ 87403803ul,
        /* 40    */ 141422324ul,
        /* 41    */ 228826127ul,
        /* 42    */ 370248451ul,
        /* 43    */ 599074578ul,
        /* 44    */ 969323029ul,
        /* 45    */ 1568397607ul,
        /* 46    */ 2537720636ul,
        /* 47    */ 4106118243ul
+#endif
+#endif
+#endif
        /* Pot's good, let's play */
       };
 
 #define PB_DS_ASSERT_NODE_CONSISTENT(_Node, _Bool)                     \
   _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, _Bool,             \
                                             __FILE__, __LINE__);)
Index: libstdc++-v3/include/bits/functional_hash.h
===================================================================
--- libstdc++-v3/include/bits/functional_hash.h (revision 226081)
+++ libstdc++-v3/include/bits/functional_hash.h (working copy)
@@ -118,12 +118,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// Explicit specialization for unsigned long.
   _Cxx_hashtable_define_trivial_hash(unsigned long)
 
   /// Explicit specialization for unsigned long long.
   _Cxx_hashtable_define_trivial_hash(unsigned long long)
 
+#ifdef __GLIBCXX_TYPE_INT_N_0
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_0)
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_0 unsigned)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_1
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_1)
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_1 unsigned)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_2
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_2)
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_2 unsigned)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_3
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_3)
+  _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_3 unsigned)
+#endif
+
 #undef _Cxx_hashtable_define_trivial_hash
 
   struct _Hash_impl
   {
     static size_t
     hash(const void* __ptr, size_t __clength,

Reply via email to