locale_facets.tcc (collate::do_hash): Fix.
authorAaron W. LaFramboise <awlaframboise@aol.com>
Mon, 11 Feb 2002 18:56:24 +0000 (18:56 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Mon, 11 Feb 2002 18:56:24 +0000 (18:56 +0000)
2002-02-11  Aaron W LaFramboise  <AWLaFramboise@aol.com>

* include/bits/locale_facets.tcc (collate::do_hash): Fix.
* testsuite/22_locale/collate_members_char.cc (test03): New test.
* testsuite/22_locale/collate_members_wchar_t.cc (test03): Same.

From-SVN: r49682

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/locale_facets.tcc
libstdc++-v3/testsuite/22_locale/collate_members_char.cc
libstdc++-v3/testsuite/22_locale/collate_members_wchar_t.cc

index 8789b9f5f50394e53f53f8ae41e83c66db74af25..68a5a97a04ee391fbbb42e9baa8d176bf928e5cf 100644 (file)
@@ -1,3 +1,9 @@
+2002-02-11  Aaron W LaFramboise  <AWLaFramboise@aol.com>
+
+       * include/bits/locale_facets.tcc (collate::do_hash): Fix.
+       * testsuite/22_locale/collate_members_char.cc (test03): New test.
+       * testsuite/22_locale/collate_members_wchar_t.cc (test03): Same.
+       
 2002-02-10  Phil Edwards  <pme@gcc.gnu.org>
 
        * include/bits/stl_algo.h (transform (both signatures), generate_n):
index c27b1eec38301ffb59226e814aa69dae91dd5661..38ee9251dc4d659aa2885d3bbf16c7eba08f87dc 100644 (file)
@@ -1855,7 +1855,7 @@ namespace std
       unsigned long __val = 0;
       for (; __lo < __hi; ++__lo)
        __val = *__lo + ((__val << 7) | 
-                      (__val >> (numeric_limits<unsigned long>::digits - 1)));
+                      (__val >> (numeric_limits<unsigned long>::digits - 7)));
       return static_cast<long>(__val);
     }
 
index ab5fe197dd0d7cad352f82dfcc1afce603ac86d6..9e49cbc2f54484fba8b2681678ad3e6d9ad40a9e 100644 (file)
@@ -147,12 +147,24 @@ void test02()
 #endif
 }
 
+void test03()
+{
+  bool test = true;
+  std::string str1("fffff");
+  std::string str2("ffffffffffff");
+
+  const std::locale cloc = std::locale::classic();
+  const std::collate<char> &col = std::use_facet<std::collate<char> >(cloc);
+
+  long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
+  long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
+  VERIFY( l1 != l2 );
+}
+
 int main()
 {
   test01();
   test02();
+  test03();
   return 0;
 }
-
-
-
index 3eba87af31cf45f5e3acc0907082f9c6d6f886e6..88e72e07100e7beb05bb512265a99d7ec86a2726 100644 (file)
@@ -146,6 +146,20 @@ void test02()
     }
 #endif
 }
+
+void test03()
+{
+  bool test = true;
+  std::wstring str1(L"fffff");
+  std::wstring str2(L"ffffffffffff");
+
+  const std::locale cloc = std::locale::classic();
+  const std::collate<wchar_t> &col = std::use_facet<std::collate<wchar_t> >(cloc);
+
+  long l1 = col.hash(str1.c_str(), str1.c_str() + str1.size());
+  long l2 = col.hash(str2.c_str(), str2.c_str() + str2.size());
+  VERIFY( l1 != l2 );
+}
 #endif
 
 int main()
@@ -153,10 +167,7 @@ int main()
 #if _GLIBCPP_USE_WCHAR_T
   test01();
   test02();
+  test03();
 #endif
   return 0;
 }
-
-
-
-