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

Unified Diff: src/wasm/encoder.h

Issue 2080153002: Revert of Implement WASM big-endian support (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « src/wasm/decoder.h ('k') | src/wasm/wasm-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/encoder.h
diff --git a/src/wasm/encoder.h b/src/wasm/encoder.h
index ea4dbe0d424ed6637a96fa15a0437790396a2876..19fc39703d63ef1f8add9036f4e42b9a001e4a41 100644
--- a/src/wasm/encoder.h
+++ b/src/wasm/encoder.h
@@ -36,13 +36,25 @@
void write_u16(uint16_t x) {
EnsureSpace(2);
- WriteLittleEndianValue<uint16_t>(pos_, x);
+#if V8_TARGET_LITTLE_ENDIAN
+ WriteUnalignedUInt16(pos_, x);
+#else
+ pos_[0] = x & 0xff;
+ pos_[1] = (x >> 8) & 0xff;
+#endif
pos_ += 2;
}
void write_u32(uint32_t x) {
EnsureSpace(4);
- WriteLittleEndianValue<uint32_t>(pos_, x);
+#if V8_TARGET_LITTLE_ENDIAN
+ WriteUnalignedUInt32(pos_, x);
+#else
+ pos_[0] = x & 0xff;
+ pos_[1] = (x >> 8) & 0xff;
+ pos_[2] = (x >> 16) & 0xff;
+ pos_[3] = (x >> 24) & 0xff;
+#endif
pos_ += 4;
}
« no previous file with comments | « src/wasm/decoder.h ('k') | src/wasm/wasm-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698