Commit 50c65fc1 authored by ivica.bogosavljevic's avatar ivica.bogosavljevic Committed by Commit bot

Fix wrong endianness of wasm header in WasmModuleWriter on big-endian platforms

BUG=mjsunit/wasm/asm-wasm-f*,mjsunit/wasm/asm-wasm-i*

Review-Url: https://codereview.chromium.org/2013393002
Cr-Commit-Position: refs/heads/master@{#36548}
parent addfd00a
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment