[libcxx-commits] [PATCH] D141623: [PHABRICATOR][z/OS] Fix cityhash lit for EBCDIC

Zibi Sarbino via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 12 10:54:03 PST 2023


zibi created this revision.
Herald added a project: All.
zibi requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141623

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


Index: libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp
===================================================================
--- libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp
+++ libcxx/test/libcxx/utilities/utility/__murmur2_or_cityhash.pass.cpp
@@ -20,12 +20,22 @@
 #  define CHOOSE_BY_ENDIANESS(little, big) (big)
 #endif
 
+#if !defined(__MVS__) || defined(__NATIVE_ASCII_F)
+#  define CHOOSE_BY_CODEPAGE(ascii, ebcdic) (ascii)
+#else
+#  define CHOOSE_BY_CODEPAGE(ascii, ebcdic) (ebcdic)
+#endif
+
 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)},
+      {"abcdefgh",
+       CHOOSE_BY_ENDIANESS(0x4382a8d0fe8edb17ULL, CHOOSE_BY_CODEPAGE(0xca84e809bef16fbcULL, 0xb6eaf957b2d7afdfULL))},
+      {"abcDefgh",
+       CHOOSE_BY_ENDIANESS(0xecefb080a6854061ULL, CHOOSE_BY_CODEPAGE(0xd7feb824250272dcULL, 0x1289b4221ba2f29aULL))},
+      {"CityHash",
+       CHOOSE_BY_ENDIANESS(0x169ea3aebf908d6dULL, CHOOSE_BY_CODEPAGE(0xea8cef3ca6f6e368ULL, 0x9a4dc95b4eac9cb8ULL))},
+      {"CitYHash",
+       CHOOSE_BY_ENDIANESS(0xe18298a2760f09faULL, CHOOSE_BY_CODEPAGE(0xf33a7700bb7a94a8ULL, 0x8162652f9d2f3a7aULL))},
   };
 
   std::__murmur2_or_cityhash<uint64_t> h64;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141623.488715.patch
Type: text/x-patch
Size: 1587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230112/b743c79a/attachment.bin>


More information about the libcxx-commits mailing list