summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoni L <EnderMoneyMod@gmail.com>2024-02-08 19:48:49 -0300
committerGitHub <noreply@github.com>2024-02-08 22:48:49 +0000
commit1263c6ab42997ebdc354e6dc203890c59791f337 (patch)
tree6aa2db65dc05d0ffdeb3216cea2cebe4c4e7c5d3
parentef851559be59ed1a77b19d03648c4fe6490e45b2 (diff)
downloadwabt-1263c6ab42997ebdc354e6dc203890c59791f337.tar.gz
wabt-1263c6ab42997ebdc354e6dc203890c59791f337.tar.bz2
wabt-1263c6ab42997ebdc354e6dc203890c59791f337.zip
Fix rot13 test on big-endian platforms (#2386)
-rw-r--r--src/test-interp.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test-interp.cc b/src/test-interp.cc
index 11e4770f..614eed33 100644
--- a/src/test-interp.cc
+++ b/src/test-interp.cc
@@ -505,8 +505,13 @@ TEST_F(InterpTest, Rot13) {
EXPECT_LT(ptr + size, memory->ByteSize());
+#if WABT_BIG_ENDIAN
+ std::copy(string_data.rbegin(), string_data.rbegin() + size,
+ memory->UnsafeData() + memory->ByteSize() - ptr - size);
+#else
std::copy(string_data.begin(), string_data.begin() + size,
memory->UnsafeData() + ptr);
+#endif
results[0].Set(size);
return Result::Ok;
@@ -527,8 +532,14 @@ TEST_F(InterpTest, Rot13) {
EXPECT_LT(ptr + size, memory->ByteSize());
string_data.resize(size);
+#if WABT_BIG_ENDIAN
+ std::copy(memory->UnsafeData() + memory->ByteSize() - ptr - size,
+ memory->UnsafeData() + memory->ByteSize() - ptr,
+ string_data.rbegin());
+#else
std::copy(memory->UnsafeData() + ptr, memory->UnsafeData() + ptr + size,
string_data.begin());
+#endif
return Result::Ok;
};