[libcxx-commits] [libcxx] 4c3d7bc - [SystemZ][z/OS] Fix cityhash lit for EBCDIC

Zibi Sarbinowski via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 17 14:43:54 PST 2023


Author: Zibi Sarbinowski
Date: 2023-01-17T16:43:48-06:00
New Revision: 4c3d7bc210f04788e5200830ab68f97e8e341cec

URL: https://github.com/llvm/llvm-project/commit/4c3d7bc210f04788e5200830ab68f97e8e341cec
DIFF: https://github.com/llvm/llvm-project/commit/4c3d7bc210f04788e5200830ab68f97e8e341cec.diff

LOG: [SystemZ][z/OS] Fix cityhash lit for EBCDIC

This will fix __murmur2_or_cityhash.pass.cpp in EBCDIC mode. The reason it fails is because of string literals are being used as input to CityHash algorithm so we need to adjust the EBCDIC expected results.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D141623

Added: 
    

Modified: 
    libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp b/libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp
index d87ddc2a137f2..e2905a450a097 100644
--- a/libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp
+++ b/libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp
@@ -20,12 +20,19 @@
 #  define CHOOSE_BY_ENDIANESS(little, big) (big)
 #endif
 
+std::string CityHash[] = {
+    {/* "abcdefgh" */ "\x61\x62\x63\x64\x65\x66\x67\x68"},
+    {/* "abcDefgh" */ "\x61\x62\x63\x44\x65\x66\x67\x68"},
+    {/* "CityHash" */ "\x43\x69\x74\x79\x48\x61\x73\x68"},
+    {/* "CitYHash" */ "\x43\x69\x74\x59\x48\x61\x73\x68"},
+};
+
 int main(int, char**) {
   const std::pair<std::string, uint64_t> TestCases[] = {
-      {"abcdefgh", CHOOSE_BY_ENDIANESS(0x4382a8d0fe8edb17ULL, 0xca84e809bef16fbcULL)},
-      {"abcDefgh", CHOOSE_BY_ENDIANESS(0xecefb080a6854061ULL, 0xd7feb824250272dcULL)},
-      {"CityHash", CHOOSE_BY_ENDIANESS(0x169ea3aebf908d6dULL, 0xea8cef3ca6f6e368ULL)},
-      {"CitYHash", CHOOSE_BY_ENDIANESS(0xe18298a2760f09faULL, 0xf33a7700bb7a94a8ULL)},
+      {CityHash[0], CHOOSE_BY_ENDIANESS(0x4382a8d0fe8edb17ULL, 0xca84e809bef16fbcULL)},
+      {CityHash[1], CHOOSE_BY_ENDIANESS(0xecefb080a6854061ULL, 0xd7feb824250272dcULL)},
+      {CityHash[2], CHOOSE_BY_ENDIANESS(0x169ea3aebf908d6dULL, 0xea8cef3ca6f6e368ULL)},
+      {CityHash[3], CHOOSE_BY_ENDIANESS(0xe18298a2760f09faULL, 0xf33a7700bb7a94a8ULL)},
   };
 
   std::__murmur2_or_cityhash<uint64_t> h64;


        


More information about the libcxx-commits mailing list