Index: src/wasm/encoder.h |
diff --git a/src/wasm/encoder.h b/src/wasm/encoder.h |
index 5d2e6c8faea1b7843ed3adb79c71fa51558f1e7e..6263284d0eef1fb47c07bf660414357c52109d75 100644 |
--- a/src/wasm/encoder.h |
+++ b/src/wasm/encoder.h |
@@ -36,13 +36,25 @@ class ZoneBuffer : public ZoneObject { |
void write_u16(uint16_t x) { |
EnsureSpace(2); |
+#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); |
+#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; |
} |