Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1431)

Unified Diff: src/wasm/wasm-external-refs.cc

Issue 2013393002: Fix wrong endianness of wasm header in WasmModuleWriter on big-endian platforms (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/wasm/encoder.cc ('K') | « src/wasm/wasm-external-refs.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-external-refs.cc
diff --git a/src/wasm/wasm-external-refs.cc b/src/wasm/wasm-external-refs.cc
index e155f3c8ba64fb0f0c321e8f307bcf384533426b..6ae15976736333c8cebb8be76d3225960c9fdd74 100644
--- a/src/wasm/wasm-external-refs.cc
+++ b/src/wasm/wasm-external-refs.cc
@@ -194,6 +194,26 @@ uint32_t word64_popcnt_wrapper(uint64_t* input) {
return static_cast<uint32_t>(base::bits::CountPopulation(*input));
}
+uint32_t word32_to_little_endianness(const uint32_t* input) {
+#if defined(V8_TARGET_LITTLE_ENDIAN)
+ return *input;
+#elif defined(V8_TARGET_BIG_ENDIAN)
+ return base::bits::ChangeEndianness(*input);
+#else
+#error Unknown endianness
+#endif
+}
+
+uint32_t word32_to_natural_endianness(const uint32_t* input) {
+#if defined(V8_TARGET_LITTLE_ENDIAN)
+ return *input;
+#elif defined(V8_TARGET_BIG_ENDIAN)
+ return base::bits::ChangeEndianness(*input);
+#else
+#error Unknown endianness
+#endif
+}
+
} // namespace wasm
} // namespace internal
} // namespace v8
« src/wasm/encoder.cc ('K') | « src/wasm/wasm-external-refs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698