From f1f25af3ad268419014e75896346cb67802baa12 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Fri, 5 Sep 2025 21:04:26 +1000 Subject: [PATCH] [orc-rt] Fix byteswap implementation for 64-bit types, rename tests. The 64-bit path included references to the llvm:: namespace that would have caused compile failures but for the fact that they were compiled out on all machines where the ORC runtime is currently tested. --- orc-rt/include/orc-rt/bit.h | 4 ++-- orc-rt/unittests/bit-test.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/orc-rt/include/orc-rt/bit.h b/orc-rt/include/orc-rt/bit.h index 97dbee2f3442b..d86c047e0973f 100644 --- a/orc-rt/include/orc-rt/bit.h +++ b/orc-rt/include/orc-rt/bit.h @@ -95,8 +95,8 @@ template >> #elif defined(_MSC_VER) && !defined(_DEBUG) return _byteswap_uint64(UV); #else - uint64_t Hi = llvm::byteswap(UV); - uint32_t Lo = llvm::byteswap(UV >> 32); + uint64_t Hi = byteswap(UV); + uint32_t Lo = byteswap(UV >> 32); return (Hi << 32) | Lo; #endif } else { diff --git a/orc-rt/unittests/bit-test.cpp b/orc-rt/unittests/bit-test.cpp index b3a3bd0428217..86e4633a5b505 100644 --- a/orc-rt/unittests/bit-test.cpp +++ b/orc-rt/unittests/bit-test.cpp @@ -34,7 +34,7 @@ TEST(BitTest, endian) { #endif } -TEST(MathTest, byte_swap_32) { +TEST(BitTest, byte_swap_32) { unsigned char Seq[] = {0x01, 0x23, 0x45, 0x67}; uint32_t X = 0; memcpy(&X, Seq, sizeof(X)); @@ -56,7 +56,7 @@ TEST(MathTest, byte_swap_32) { #endif } -TEST(MathTest, byte_swap_64) { +TEST(BitTest, byte_swap_64) { unsigned char Seq[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}; uint64_t X = 0; memcpy(&X, Seq, sizeof(X));